Compress and Archive a file

Post questions here relative to DataStage Server Edition for such areas as Server job design, DS Basic, Routines, Job Sequences, etc.

Moderators: chulett, rschirm, roy

Post Reply
rajkraj
Premium Member
Premium Member
Posts: 98
Joined: Wed Jun 15, 2005 1:41 pm

Compress and Archive a file

Post by rajkraj »

Hi,

I have a requirement where i after the Job is run successfully ,I have to compress the file and Archive it.
Right now i am just using a Execute command stage to Archive the file by using mv #Path#/file1.txt #ArchivePath#/file1.'date +"%Y%m%d"`.txt
without compressing it.
How can i compress the file and archive it with a date stamp.

Thanks in advance.
Maveric
Participant
Posts: 388
Joined: Tue Mar 13, 2007 1:28 am

Post by Maveric »

try gzip FilePath/test.txt > FilePath/test.gz. Should work not sure though.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Yes, you'll need to write a script to do this properly and to have the proper levels of error checking. For archiving multiple files at once, consider a 'tar ball' - a tar archive that is then compressed. And for compression, you've got 'compress' that should always be there on UNIX plus optional tools like zip or gzip.

Check with your SA if you're not sure what options you have.
-craig

"You can never have too many knives" -- Logan Nine Fingers
Post Reply