Link to home
Start Free TrialLog in
Avatar of niallo32
niallo32

asked on

How can I compress a number of files to a .tar.gz file using cygwin

I need to compress a number of files in XP into a .tar.gz file

Can anyone explain the steps to do so using cygwin?

Thanks
Avatar of JIEXA
JIEXA
Flag of Israel image

1. tar and gzip should be installed as a part of your Cygwin installation.
2. the command is like:
   tar -zcf c:/your-archive-file-name.tar.gz c:/path1-to-all-files "c:/path2 with space/fileXYZ.dat" c:/temp/mylog.txt
ASKER CERTIFIED SOLUTION
Avatar of Lee
Lee
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Kerem ERSOY
Kerem ERSOY

You can also create compressed archives using the z switch as such:

tar -cvzf /cygwin/c/Documents and Settings/user/compressed.tar.gz   /cygwin/c/path

to create an compressed archive.

then to reopn the archive you can use:

tar xvzf /cygwin/c/Documents and Settings/user/compressed.tar.gz

GNU tar will remove the beginning "/" during decompress so it will ope the archive relative to the current path. So if you want to restore /cygwin/c/path to the same folder then you need to be at /cygwin/c or otherwise files will be restore relative to current path. Not the root itself.

Cheers,
K.