how to zip a dir
i need to zip a dir, which contains files and other dir.
i am able to zip the folder along with the files but not the directories present in it. how should i zip a dir along with the contained dir and files. regards shravee |
You can use tar
Code:
tar cvzf foo.tgz directory |
If you actually want to produce a zip file, why don't you read the man page for "zip"?
|
Use -r to descend into directory recursively.
eg: zip -r foo foo |
Please, check the man page for zip, tar, 7z or whatever tool you want to use to compress the files. Then, if you still have some concrete doubt, come back.
|
Consier abc is a directory
To zip that directory , execute - zip abc.zip abc To unzip it - unzip abc.zip |
@soumyacs: The OP has a specific issue where folders inside parent folder are left as it is and not included in the zip archive. -r option is needed for recursive descent into folders.
|
hi repo,
cant i get the compressed folder in .zip format which solves my problem of compressing subdirectories also. |
Hi Shravee,
You can try with the below command. # zip -r <dirname>.zip <dirname> -- which will zip the entire dir/files contained in the parent directory recursively. for eg : $ zip -r orange.zip orange adding: orange/ (stored 0%) adding: orange/potato (stored 0%) adding: orange/test/ (stored 0%) adding: orange/test/ptsadminlog (deflated 88%) $ $ du -sh orange* 272K orange 32K orange.zip $ Works for me. Note : Please try and let me know incase if you still face any issues. Regards, RHADMN |
thanks
thanks rhadmn,
its working for me......... too. regards shravee |
All times are GMT -5. The time now is 07:29 AM. |