Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

concatenate, compress the files and archive the file somewhere. 1

Status
Not open for further replies.

bhagabati

Programmer
Apr 8, 2003
8
AU
I am very new to unix, I need to navigate to different directories and concatenate the files to one file, then compress the file and archive to another directory.

I was thinking of using cat, gzip and mv commands. Please can some one give me bit of help.

Thanks in advance
 
This is your lucky day. I was looking for the same thing just a few weeks ago.

Try this, it has worked great:

It makes an assumption about being in the directory you wish to backup, so if that is not the case, tweak it or post again and I will post my tweak.
-Cheers.
 
Thanks gamerland for your help.
It does similar work but I need to select the number of files with the generation numbers such as test1, test2 and so on from a directory where lots of othere files exists and then concatinate them to a combined file called datetime and compress the datetime. Then move to some other archive directory. I am still working on it, has not been able to solve completely.
 
Are you trying to do this in a script or manaully?

-B :cool:
birbone@earthlink.net
 
How about something like tar cvf tarfile file?
followed by compress tarfile
 
Greetings again,
I believe we are still okay, just a few tweaks needed. Give me an example of the files in the directory and then the files you wish to have in this "combined" file.

Also give an idea of how you know what to name it.
 
I have got a directory structure a/b/error, a/b/report and error directory has error.log1, error.log2...... filese and report directory has report.log1 report.log2..... and my aim is to crearte a file totalerror.log and totalreport.log in their respective directories and then move both "total.." files to the directoty a/b/archive. To start the script I want to pass the file and directory name as a parameter.
such as

./backup.sh archive error report and so on.
 
BHagabati,
I'm looking to do a very similar thing as your question. However, I didn't look like anyone actually gave you a final reply/solution. Did you get a script / tip on solving this?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top