Zipping the files in UNIX having extension after


 
Thread Tools Search this Thread
Top Forums UNIX for Beginners Questions & Answers Zipping the files in UNIX having extension after
# 1  
Old 09-28-2016
Power Zipping the files in UNIX having extension after

Hi Folks

I have a logs file at directory cd /opt/app/logs named as

Code:
     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 Smilie
# 2  
Old 09-28-2016
Is this a homework assignment? Homework and coursework questions can only be posted in the Homework & Coursework forum under special homework rules.

Please review the rules, which you agreed to when you registered, if you have not already done so.

If you did post homework in the main forums, please review the guidelines for posting homework and repost. If this is not a homework assignment, please explain why you need to do this in real life and more clearly explain what you are trying to do.

You seem to indicate that these filenames are contained in another file? If that is the case, what is the pathname of that file?

Do these filenames really have that many leading spaces as part of their filenames?

Are you trying to zip all of these log files into a single archive, or are you trying to zip each log file into a separate archive?

What utility do you want to use to zip these log files? (Different UNIX and UNIX-like operating systems use different utilities such as zip, gzip, pack, compress, or something else depending on what operating system you're using, what version of that operating system you're using, and what you intend to do with the archives you create.)
# 3  
Old 09-28-2016
Wrench

Hi Don Cragun,

This is not an homework question please rite now because of log issues the disk space is increasing so rite now i want to put these logs in zip format immediately

so rite now at the location there are many files having .log extension and few files having extension *.log.* , so i want to zip these files specially at current location.

yes i want to zip all these log files into a single archive named with backlogs+timesstamp.zip , in which timestamp will be the current timestamp

Well i am looking for .gzip utility
# 4  
Old 09-28-2016
Your request is FAR from clear. With a daring inference from my side, try
Code:
gzip -c *.log* >"backlog$(date +'%Y%m%d%H%M').zip"

# 5  
Old 09-29-2016
If you are out of space, where will you write the compressed file to? Both the originals and the target will have to exist whilst this is in progress.

Can you force some off to either another server or to removable media, e.g. tape? If you can clear some space then the process to work on them will be much simpler, although you might need to have several zip files as you process each block.

Where are you up to? Can you show us the output from:-
Code:
uname -a
df -k
du -kxs /path/to/files


Kind regards,
Robin
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Find and removing the old files and zipping the files using shell script

Hi, I am trying to removing the old files which were older than 10 days and same g zipping the files using the shell script. script was return as follows. find /jboss7_homes/JBOSS7/SKYLIV??/SKYLIV??_CRM/jboss-eap-7.0/standalone/log -mtime +10 -type f | xargs rm -f find /cer_skyliv??/log... (6 Replies)
Discussion started by: venkat918
6 Replies

2. Shell Programming and Scripting

Zipping without extension

I currently have a code that find and zip all files in current folder and zip it, the problem is the name of the zip will include the extension as well and I don't want it. for ex: Volvo-red.swf -> Volvo-red.swf.zip find . -maxdepth 1 -type f ! -name ".*" -exec bash -c 'zip -r "$0.zip"... (6 Replies)
Discussion started by: Frozen77
6 Replies

3. UNIX for Dummies Questions & Answers

Display the .csv extension files based on .done extension fine

Hi All, I want to fetch the files based on .done file and display the .csv files and Wil take .csv files for processing. 1.I need to display the .done files from the directory. 2.next i need to search for the .Csv files based on .done file.then move .csv files for the one directory ... (2 Replies)
Discussion started by: girija.g6
2 Replies

4. Shell Programming and Scripting

Zipping files

Hi Guys, The script below works but it creates a zip folder under 123_arch.zip -- test1 -- orig1.txt -- orig2.txt -- orig3.txt -- orig4.txt I don't want the sub directory test1 but everything under the base *arch name I can not create a long name with... (4 Replies)
Discussion started by: GaryP1973
4 Replies

5. UNIX for Dummies Questions & Answers

Zipping files

Hi All, I have a scenario where in am using uuencode to send a txt file as an excel to end users( email attachment).I have 7 different files and these files are sent as emails 7 times... So my question is, can i not zip all the 7 files at once and attach those files in a single... (9 Replies)
Discussion started by: saggiboy10
9 Replies

6. Shell Programming and Scripting

Help with zipping files

Hi, I have come across a requirement in which I need to zip files. This is fine but the requriement has one conditions like below: One .z file can not have more than 10,000 files Now in the directory I have several files liek below: aaa_file_10_00001.txt aaa_file_10_00002.txt... (6 Replies)
Discussion started by: angshuman
6 Replies

7. Shell Programming and Scripting

zipping files

Hi, Is there any difference if files are individually zipped and archived in a directory or if files are moved into archiving directory and zipping that directory. (3 Replies)
Discussion started by: swathich
3 Replies

8. UNIX for Dummies Questions & Answers

Zipping up files in AIX UNIX

I need the command to add single pdf's to one zip file. I have tried gzip but all I can achieve is each file individually being zipped. This zip file then needs to be compatable with a windows unzip application such as winzip. (7 Replies)
Discussion started by: Dolph
7 Replies

9. UNIX for Dummies Questions & Answers

Zipping files?

how would i zip a file? what does zip mean? (4 Replies)
Discussion started by: trob
4 Replies

10. Shell Programming and Scripting

zipping files

Dear Experts, I need a script which will zipped the files older than 2 days. but i dont want to use find . * -mtime 2. Is there is any other method to achive this task. i will ececute the script daily. Regards, (3 Replies)
Discussion started by: shary
3 Replies
Login or Register to Ask a Question