11-25-2009
Need script to tar files older than 30 days
Hi all. Here's my situation:
I have performance reports that run every 30 minutes saved in the format:
stats_report_11251000.txt
stats_report_11251030.txt
stats_report_11251100.txt
stats_report_11251130.txt
(Obviously run at Nov 25 10 AM, 10:30 AM, 11 AM and so on...)
I would like to write a script that will tar each months report into a tar file named something like stats_reports_November2009.tar
This script will run at midnight on the first day of each month so no special date processing with the file name will need to be done.
How can I do a find on all files older than one month (can't be in days as there are different days in each month) and pipe it to a tar command?
All help is appreciated.
Thanks
10 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
Hi there,
I am trying to tar a number of files held in a specific folder. I am only interested in archiving files older than 30 days. Having read through the man entries and all available documentation I thought I'd cracked the coomand with
tar -c -z -v -N 15/04/2004 -f /wfch.tar *
This... (6 Replies)
Discussion started by: wfch
6 Replies
2. Shell Programming and Scripting
Hi ,
I have a file abc.txt which actually contains a directory and file list
-rwxrwxr-x 1 dmadmin mmasapp 334 Dec 03 2001 aafs_006.ksh
-rwxrwxr-x 1 dmadmin mmasapp 1270 Nov 13 2001 mcl_deposit_ftp.ksh
-rwxrwxr-x 1 dmadmin mmasapp 925 Oct 31 2001 ... (1 Reply)
Discussion started by: viv1
1 Replies
3. Solaris
Hello,
I need help in finding files older than x days and creating a single consolidated tar file combining them. Can anyone please provide me a script?
Thanks,
Dawn (3 Replies)
Discussion started by: Dawn Bosch
3 Replies
4. Shell Programming and Scripting
I'm new to shell script.... can any one help...
What is the shell script to delete the files older than 2 days ? (3 Replies)
Discussion started by: satishpabba
3 Replies
5. Shell Programming and Scripting
Hi,
I'm Eddy from Belgium and I've the following problem.
I try to write a ksh script in AIX to tar, compress and remove the original *.wav files from the directory belgacom_sf_messages older than two days with the following commands.
The problem is that I do not find a good combination... (4 Replies)
Discussion started by: edr
4 Replies
6. Shell Programming and Scripting
Hi
I need help in the script which looks at a contorl file which has a list of file names like xxxx.12345 and I want to take only xxxxx and search in a specific directory and remove the file if its older than 60 days
I have written something like this.. but seems to be wrong... (1 Reply)
Discussion started by: antointoronto
1 Replies
7. Shell Programming and Scripting
hi i need a script to delete the files older than 2 days...
if my input is say in a folder versions
A_14122012.txt
A_15122012.txt
A_16122012.txt
A_17122012.txt
i want my output to be
A_16122012.txt
A_17122012.txt
thanks in advance
hemanth saikumar. (2 Replies)
Discussion started by: hemanthsaikumar
2 Replies
8. Shell Programming and Scripting
Hi
I'm trying to writte a script (crontab) to copy files from one location to another... this is what i have:
find . -name "VPN_CALLRECORD_20130422*" | xargs cp "{}" /home/sysadm/patrick_temp/
but that is not working this is the ouput:
cp: Target... (5 Replies)
Discussion started by: patricio181
5 Replies
9. Shell Programming and Scripting
I need a script file for backup (zip or tar or gz) of old log files in our unix server (causing the space problem). Could you please help me to create the zip or gz files for each log files in current directory and sub-directories also?
I found one command which is to create gz file for the... (4 Replies)
Discussion started by: Mallikgm
4 Replies
10. UNIX for Dummies Questions & Answers
we need to have periodic clean up implemented in our sap directory \\sapds\PR1\int\scm\snp\outbound\snapshot. which needs unix script for Deleting files older than 14 days automatically in sap system unix os. (1 Reply)
Discussion started by: kvkreddy_b2w
1 Replies
LEARN ABOUT DEBIAN
nnstats
NNSTATS(1m) NNSTATS(1m)
NAME
nnstats - display nnmaster collection and expire statistics
SYNOPSIS
nnstats [ -lt ] [ -d month day ] [ -m month ] [ logfile ]...
DESCRIPTION
nnstats will extract the collection (C) and expiration (X) entries from the log file and calculate total and average number of articles,
groups and elapsed time per day, per month, or for the duration of the whole log file.
Normally only a summary for the specified period is printed. If -l is specified, the statistics for each day in the period is also
printed, and if -t is specified the summary is not printed.
Normally the statistics is collected for all days in the log files (or the current log file if one is not specified).
If "-m month" is specified, the statistics for that month is calculated. The month is specified in normal date notation, i.e. a capital-
ized three letter abbreviation like Jan, Feb, ...
If "-d month day" is specified, the statistics for that date only is calculated and printed.
FILES
../Log The log file
SEE ALSO
nn(1), nnusage(1M), nnadmin(1M), nnmaster(8)
NOTES
If nnmaster is run with options -LCX, nnstats will not work, because the necessary entries are not written to the log file.
AUTHORS
Mark Moraes <moraes@csri.toronto.edu>
Kim F. Storm <storm@texas.dk>
4th Berkeley Distribution Release 6.6 NNSTATS(1m)