compress Directory

Hi Friends,

I have a directory under which 10 more directories are there.
In each 10 directories there are several files.
I want to do FTP. But in FTP we cannt Transfer the main directory.
each Time we have to go to the respective directry and then we have to to FTP.

For this instance I have to go to the each 10 directry and then do the FTP.

is there any way we can compress the main directry?
Like in windowds we make .zip files.

Thanks In advance!!
Deepak

use 'tar' to archive what you need and transfer a tar file.

I dont think tar ll work . Bcoz for tar we need to have tape drive.
Then we can use tar -cvf filename.

why do you need a tape drive?

Thanks Its working !!
tar -cvf sales_mkt.tar M2_Sales
tar -xvf sales_mkt.tar

I need one more help.
can we make it .zip file .so that i can FTP the .zip file and
in windows i ll unzip it through winzip

Thanks in advance!!

depending on your OS/installation - look into 'zip', 'gzip', 'compress' or 'pack'

Hi Vgersh99,
Thanks for your quick response.

I can make .zip fies like the following way

tar -cvf sales_mkt.zip M2_Sales.
But when I FTP it and try to unzip it in windows through winzip .It gives me error.

But the reverse way is possible .I can unzip the folder in windows.
Then ftp it (bin mode)into unix server .then I can unzip it like

$unzip filename.zip

no, creating a tar file with the '.zip' extention isn't the same as creating a tar ball with the .tar extention and using zip/gzip/compress/pack/whatever to 'compress' the tarball.

deep_kol ,

You can perform an FTP of the required directories/files.

Do the following:

  1. tar -cVf ${ARCHIVE_FILE}.tar ${Directory1/File1} ${Directory2/File2} ...
  2. If Available: gzip -9 ${ARCHIVE_FILE}.tar
  3. Or, if Available: compress ${ARCHIVE_FILE}.tar
  4. Then perform your FTP ... put ${ARCHIVE_FILE}.tar[.gz/.Z]

Hope that helps identify what has been mentioned already.

Cheers,
Cameron Young

Hi deep_kol

Try

tar -czvf sales_mkt.tgz M2_Sales.

On windows use 7z to decompress.

Regards,