04-07-2008
Zipping files older than one month
I have to zip all files older than a month within a directory.
I have to archive them using the file extension
I have .dat, .csv ,.cnt files within the directory.
I used the following command It doesnt work
find /path/*.dat -mtime +30
This command doesnot display .dat files older than a month
I used a different method which is tedious, but does the zipping month wise
zip dat_zip.zip `ls -rtl *.dat|grep Jan |awk '{print $9}'`
After doing this I have the zip files in the zip directory, but if i remove Jan files from the folder using this command
ls -rtl *.dat | grep Jan | awk '{print $9}' | rm *.dat
I lose all the dat files for other months too.
As per my knowledge '|' gives o/p from previous command as I/p for next command , why am i losing all the .dat files(from other months too)
Guru's Please shed some light.
Thanks and Regards,
Ram.
10 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
how would i zip a file?
what does zip mean? (4 Replies)
Discussion started by: trob
4 Replies
2. Shell Programming and Scripting
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
3. Shell Programming and Scripting
Hi,
I would like to ask about some question on the -mtime option in the find command. I want to move a log files older than one month and planning to used the find -mtime +30 but i have some clarrification does -mtime +30 or -30 refer to x days beyond or between so how about the month. suppose... (2 Replies)
Discussion started by: jao_madn
2 Replies
4. Shell Programming and Scripting
Hi All,
In my team we generate huge logs and many a times due to this our total system crumbles.
I want to write a script which compares the file modification time with the current time and then if the difference is more than 'n' days the file is zipped , if the difference is more than ' n'... (4 Replies)
Discussion started by: DeepPaddy
4 Replies
5. UNIX for Dummies Questions & Answers
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
I need month older lines from a file
file
1 666 2013-08-23 04:24:11
33 543 2013-06-11 18:04:20
33 413 2013-06-20 1:40:54
1 776 2013-08-20 18:04:21
.0 877 2013-08-21 05:50:04
I'm checking older lines... (8 Replies)
Discussion started by: Roozo
8 Replies
7. Shell Programming and Scripting
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
8. Shell Programming and Scripting
Hi,
I need all file names in a folder which has date >= 10th of last month,
Example
: files in folder
AUTO_F1_20140610.TXT
BUTO_F1_20140616.TXT
CUTO_F1_20140603.TXT
FA_AUTO_06012014.TXT
LA_AUTO_06112014.TXT
MA_AUTO_06212014.TXT
ZA_AUTO_06232014.TXT
Output:
AUTO_F1_20140610.TXT... (9 Replies)
Discussion started by: nani1984
9 Replies
9. UNIX for Beginners Questions & Answers
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
10. UNIX for Beginners Questions & Answers
-bash-4.1$ hdfs dfs -ls -R /data/backup/prd/xyz/ | grep '^d'
drwxr-xr-x - abisox abadmgrp 0 2018-05-05 01:03 /data/backup/prd/xyz/20180301
drwxr-xr-x - abisox abadmgrp 0 2018-05-05 01:03 /data/backup/prd/xyz/20180302
drwxr-xr-x - abisox abadmgrp 0 2018-05-05 01:03... (2 Replies)
Discussion started by: himanshupant
2 Replies
LEARN ABOUT DEBIAN
arp2ethers
ARP2ETHERS(8) System Manager's Manual ARP2ETHERS(8)
NAME
arp2ethers - convert arpwatch address database to ethers file format
SYNOPSIS
arp2ethers [ arp.dat file ]
DESCRIPTION
arp2ethers converts the file /var/lib/arpwatch/arp.dat (or the file specified on the command line) into ethers(5) format on stdout. Usu-
ally arp.dat is an ethernet/ip database file generated by arpwatch(8). The arpwatch daemon in Debian will create different arp.dat depend-
ing on its configuration. All of them will be available at /var/lib/arpwatch/.
FILES
/var/lib/arpwatch - default directory for arp.dat
arp.dat - ethernet/ip address database
SEE ALSO
arpwatch(8), ethers(5), rarp(8), arp(8),
BUGS
Please send bug reports to arpwatch@ee.lbl.gov.
AUTHORS
Original version by Craig Leres of the Lawrence Berkeley National Laboratory Network Research Group, University of California, Berkeley,
CA.
Modified for the Debian Project by Peter Kelemen, with additions from Erik Warmelink.
The current version is available via anonymous ftp:
ftp://ftp.ee.lbl.gov/arpwatch.tar.gz
This manual page was contributed by Hugo Graumann.
ARP2ETHERS(8)