Creating Zip of directory in Unix m/c - unix

on Unix m/c i have folder in which there are few more folders..
I wants to make zip file of parent folder. and i should able to unzip this zip file in windows m/c..
Can you please advice..
thanks in advance..

given that the program 'zip' is available, the following should work:
zip -r archive_name.zip folder

From midnight commander highlight the directory that you want to zip, then press F2 to get to the user menu, then # to perform an operation on it. You can now enter zip -r archive.zip followed by return, where archive.zip is that name of the zip file that you want to create.

zip -r parent-directory parent-directory
If you have zip installed on your Unix host.
It will create parent-directory.zip file and it can be unzipped on Windows using native unzip Windows program.

Related

Winzip command line - Include full path information

How do I use winzip command line with include full path information ? I know I can do this under Winzip GUI but how to do it using cmd ? Also, is there a way to zip selected specific folders only ? Thanks
Tried GUI and it is working very slow
Winzip command line doesnt seem to zip selected folders - either parent folders or specific subfolders
I am using winzip 27 command line and this is the syntax I am using:
wzzip -a -e0 -k -P -r -yx "C:\Users\source\to\save\zipfile.zip" "C:\example"
This stores files and folder timestamps underneath C:\example. But since I have enabled -P -r, I want to store the timestamps of the upper folder, C:\example folder. How can I do that ? Does anyone have suggestions?
Also, how do I specify the path for a mapped network drive? Thanks!

zipping the files in unix having extension after

I have a logs file at directory cd /opt/app/logs named as
coa.log.1
uoa.log.2
erete-rere.log.1
now my concern is that i am looking for unix command which will zip the files having extension log.1 or log.2 or having log. extension anything
request you to please advise the unix comand to zip these files
Folks please advise for this
You can compress in a lot of formats in unix. The most commom is the tar.gz extension. If you are looking fot .zip specifically, there is a zip command: zip <zipname> <files>
To pass the file list you may use the * wirldcard, indicating any name. For example: *.log.*, as sugested by glen, will match every file that contains .log. in its name.
You probably want something like this:
zip backup_logs.zip /opt/app/logs/*.log.*
This will zip all files in the folder that matched what you asked and create a zip file in your current directory.

Unzipping a folder( not empty ) to a new named folder

I have a folder called newfast.zip in my remote server. I required to unzip as xyz folder. ( say xyz is my new folder name ), I tried like this:
[xxxxx#xxxxxautosuggest unzip]$ unzip newfast.zip xyz
Archive: newfast.zip
caution: filename not matched: xyz
[mohamear#stic-scm-autosuggest unzip]$ cl
But I turn with error. any one help me here please?
And any one suggest me the good tutorial page to learn all useful command of putty
Suggested work around: Create a directory, lets say zipcontent and then unzip the content into that dir: unzip file.zip -d zipcontent/
Suggested workaround: Unzip the folder to whatever it unzips to and rename it afterwards.

zip command in unix with wildcards

I am trying to zip file which is in the format of Amazon*.xls in unix and also remove the source file after compression.Below is the used command
zip -m Amazon`date +%Y-%m-%d:%H:%M:%S`.zip Amazon*.xls
For the above command i am getting below error
zip I/O error: No such file or directory
zip error: Could not create output file Amazon.zip
PS: GZIP is working fine. I need zip format files.
It is not the zip, it is how your shell deals with expanding/substituting variables. Two lines solution for bash
export mydate=`date +%Y-%m-%d:%H:%M:%S`
zip -m Amazon_$mydate.zip *matrix*
Execute by hand (few secs difference) or better put in a shell script myzipper.sh and just source it.
Use '-p' instead of '-m', if zip files are to be extracted on Windows OS.
export mydate=date +%Y-%m-%d:%H:%M:%S
zip -p Amazon_$mydate.zip matrix

unzip all files and save all contents in a single folder - unix

I have a single directory containing multiple zip files that contain .jpg files.
I need to unzip all files and save all contents (.jpgs files) into a single folder.
Any suggestions on a unix command that does that?
Please note that some of the contents (jpgs) might exist with same name in multiple zipped files, I need to keep all jpgs.
thanks
unzip '*.zip' -o -B
as by default these utilities are not installed
see http://www.cyberciti.biz/tips/how-can-i-zipping-and-unzipping-files-under-linux.html regarding installation
read about -B flag to realize its limitations.

Resources