Alot depends on how your main drive is mapped in cygwin. Mine are mapped so that I can do things like cd /c to get to the root of the c drive. By default, if memoery serves me, it is mapped in this way:
/cygdrive/c for c drive
/cygdrive/d for d etc.
So let's assume you want to tar/gzip your documents (.doc) files in the "My Documents" folder.
tar -zcf ~/docs.tar.gz /cygdrive/c/Documents\ and\ Settings\username\My\ Documents\*.doc
The zcf means (z) compress using gzip, (c) create new archive and (f) filename of archive. The ~/ means to create the output file (docs.tar.gz) in your home folder in cygwin and the last portion of the command is what files do you want to add to the archive. You can add as many file paths, files and folders here as you like on the single command line.
If you want to see which files go into the archive as it is working replace zcf with zcvf for verbose output.
To decompress, use tar -xf docs.tar.gz or xvf for verbose output.
Cheers,
Lee
Main Topics
Browse All Topics





by: JIEXAPosted on 2009-07-19 at 00:47:33ID: 24888583
1. tar and gzip should be installed as a part of your Cygwin installation. tar.gz c:/path1-to-all-files "c:/path2 with space/fileXYZ.dat" c:/temp/mylog.txt
2. the command is like:
tar -zcf c:/your-archive-file-name.