In Linux world Zip command is not as popular as Gzip probably because of its compression where as in Windows we use it more frequently than Gzip. Recently one of my colleague asked for a command to Zip a folder in Linux environment. After Googling few websites I got below solution :
zip –r <Folder1.zip> <Folder1>
Here -r parameter recursively compresses the folder passed as parameter.
This command will result compressed Folder1 with all its contents recursively in Folder1.zip file. Here one thing I have noticed that Zip command reports error while Zipping Folders with name containing special characters like _ underscore or hyphens – or . dots. Not sure why it happened, but I don’t have solution for it now.
If you want to reverse the zipped file back to folder you can use below command :
unzip Folder1.zip -d /temp
This command will result Folder1.zip to be extracted under temp path as Folder1 directory.
0 Comments:
Post a Comment