Zip a file with path


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Zip a file with path
# 1  
Old 12-19-2012
Zip a file with path

zip /var/log/mylog.log mylog.1.log but its not working
# 2  
Old 12-19-2012
What exact command did you use?
ex.:
Code:
zip newzipfilename.zip /var/log/mylog.log


Last edited by jim mcnamara; 12-19-2012 at 10:27 PM..
This User Gave Thanks to jim mcnamara For This Post:
# 3  
Old 12-19-2012
the zip command but i dont know how to use it
# 4  
Old 12-19-2012
That is what I just gave you an example of.
# 5  
Old 12-19-2012
i want to compress a specific file
zip /var/log/mrnet.log (into mrnet.log.1.gz)
is it possible
# 6  
Old 12-19-2012
you would use

Code:
gzip -S .1.gz /var/log/mrnet.log

But from the filepath and name you really should setup a logrotate entry as /etc/logrotate.d/mrnet something like this

Code:
/var/log/mrnet.log
{
    weekly
    create
    compress
    rotate 4
    missingok
}

This User Gave Thanks to Chubler_XL For This Post:
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How can we Zip multiple files created on the same date into one single zip file.?

Hi all i am very new to shell scripting and need some help from you to learn 1)i have some log files that gets generated on daily basis example: i have abc_2017_01_30_1.log ,2017_01_30_2.log like wise so i want to zip this 4 logs which are created on same date into one zip folder. 2)Post zipping... (1 Reply)
Discussion started by: b.saipriyanka
1 Replies

2. UNIX for Beginners Questions & Answers

How can we Zip multiple files created on the same date into one single zip file.?

Hi all i am very new to shell scripting and need some help from you to learn 1)i have some log files that gets generated on daily basis example: i have abc_2017_01_30_1.log ,2017_01_30_2.log like wise so i want to zip this 4 logs which are created on same date into one zip folder. 2)Post zipping... (2 Replies)
Discussion started by: b.saipriyanka
2 Replies

3. Linux

Unable to ZIP without path

We have been trying to zip a file with a Jenkins linux build server with a network path. We were trying use the different options for zip. We either get the full directory path with zip -r option or no directory with zip -j We need just the main path without the network path:example: /Documents... (2 Replies)
Discussion started by: Kenp11
2 Replies

4. Shell Programming and Scripting

Zip Multiple files to One .zip file in AIX system

Hi I have a requirement in unix shell where I need to zip multiple files on server to one single .zip file. I dont see zip command in AIX and gzip command not doing completely what I want. One I do .zip file, I should be able to unzip in my local Computer. Here is example what I want... (9 Replies)
Discussion started by: RAMA PULI
9 Replies

5. Shell Programming and Scripting

Find file and zip without including directory path

Does anyone know of a way to zip the resulting file from a find command? My approach below finds the file and zips the entire directory path, which is not what I need. After scanning the web, it seems to be much easier to perform gzip, but unfortunately the approach must use zip. find `$DIR`... (5 Replies)
Discussion started by: koeji
5 Replies

6. UNIX for Dummies Questions & Answers

Zip a file with .zip extension.

Hi, I need to zip a .dat file with .zip extension. I tried using the "zip" command. But shell says. "ksh: zip: not found" Currently I am using gunzip to zip and changing the extension ".gz" to ".zip" as follows. mv $file `echo $file | sed 's/\(.*\.\)gz/\1zip/'` But when I tried... (1 Reply)
Discussion started by: aeroticman
1 Replies

7. AIX

ZIP multiple files and also specify size of zip file

I have to zip many pdf files and the size of zip file must not exceed 200 MB. When size is more than 200 MB then multiple zip files needs to be created. How we can achieve this in UNIX? I have tried ZIP utility but it takes a lot of time when we add individual pdfs by looping through a... (1 Reply)
Discussion started by: tom007
1 Replies

8. Linux

How to create zip file without path?

Hello, I have generated a PHP script that creates files needed for EPUB file. I have a temp directory where these files are created into and then needs to be zipped. The directory structure is: mimetype content.opf index.html stylesheet.css toc.ncx META-INF META-INF/container.xml ... (4 Replies)
Discussion started by: spaze
4 Replies

9. Shell Programming and Scripting

Get zip path from unzip -l

I am listing the contents of a zip file and then grepping for a specific string ie: filename.a to get a line like: 309753 10-18-08 15:20 etc/filename.a The etc/filename.a is the path the file is at within the zip file...how might I capture this path as I want to use that path to unzip that... (2 Replies)
Discussion started by: phreezr
2 Replies

10. UNIX for Dummies Questions & Answers

unzip .zip file and list the files included in the .zip archive

Hello, I am trying to return the name of the resulting file from a .zip archive file using unix unzip command. unzip c07212007.cef7081.zip Archive: c07212007.cef7081.zip SecureZIP for z/OS by PKWARE inflating: CEP/CEM7080/PPVBILL/PASS/G0063V00 I used the following command to unzip in... (5 Replies)
Discussion started by: oracledev
5 Replies
Login or Register to Ask a Question