Operating System - Tru64 Unix
1753794 Members
7068 Online
108799 Solutions
New Discussion юеВ

create an archive based on a list of files

 
SOLVED
Go to solution
john korterman
Honored Contributor

create an archive based on a list of files

Hello archive experts!

I am in the process of migrating a system from True64 to hpux.

Part of the job is to move a huge number of files: between 10000 and 30000, average size smaller than 1kb.

Various people specify which files to move; their input is in the shape of "from underneath these points in the file-hierarchy", bur excluding "from underneath those points in the file-hierarchy".

My idea is to find the relevant files and list their full paths as individual lines in a single file - an then use this file as basis for making an archive.

The above mentioned file has been created, and I then tried to create a pax archive this way:

#Initially, create a pax archive holding a single, empty file
pax -w -f ${DESTINATION_DIR}/${PAX_FILE} ${EMPTY_FILE}

#Then append each file from the list of files in TO_INCLUDE:
while read tag_med_linie
do
pax -w -a -t -f ${DESTINATION_DIR}/${PAX_FILE} "$tag_med_linie"
done <${TO_INCLUDE}


which works. However, seems slow - perhaps because of the huge number of files, perhaps because appending is slow, or perhaps my expectations are set too high.

Can anyone suggest a way creating an archive faster, keeping it based on input from the beforementioned file.
Other archive types are welcome as long as they can be created on standard True64 and read in on hpux.

Best regards,
John K.
it would be nice if you always got a second chance
5 REPLIES 5
Michael Schulte zur Sur
Honored Contributor
Solution

Re: create an archive based on a list of files

Hi John,

you may want to try xargs not to run pax for every file to add.

cat ${TO_INCLUDE} | xargs -I{} pax -w -a -t -f ${DESTINATION_DIR}/${PAX_FILE} "{}"

greetings,

Michael
john korterman
Honored Contributor

Re: create an archive based on a list of files

Thank you very much Michael: it is definitely much faster.

Best regards,
John K.
it would be nice if you always got a second chance
Orjan Petersson
Frequent Advisor

Re: create an archive based on a list of files

Even simpler is

cat ${TO_INCLUDE} | pax -w -t -f ${DESTINATION_DIR}/${PAX_FILE}
Michael Schulte zur Sur
Honored Contributor

Re: create an archive based on a list of files

Hi Orjan,

you are right. I did not know that pax also reads from stdin.

greetings,

Michael
john korterman
Honored Contributor

Re: create an archive based on a list of files

Thank you Orjan,

it works even faster!

Best regards,
John K.
it would be nice if you always got a second chance