Purge files, keep 3 versions of last 4 days


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Purge files, keep 3 versions of last 4 days
# 8  
Old 10-28-2002
The above logic makes (rather unreasonable) assumption that the time stamps are exactly 7:30pm and 8pm for the 1st and 3rd files, which may not be possible practically... though, you can overcome this by increaing the time range by few minute on either ends...

Yes the best way would be (as Perderabo suggests) to create the "latest" 3 files in a separate directory, instead of cluttering them with unwanted files.. it would amount to a simple logic using date command...
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Purge X old days files and Print count

Hello All, I am trying to purge X old days of files from directory & Sub directories ./2016-01-13/1500/abc.txt ./2016-01-14/1605/caf.txt ./2016-01-14/1605/caf2.txt ./2016-01-14/1606/eaf.txt ..... ./2017-08-1/1701/ Should also remove directories and sub directories too Expected... (7 Replies)
Discussion started by: krux_rap
7 Replies

2. Shell Programming and Scripting

To create a script and schedule which purge 30 days old files

Hi Friends, Very new in Unix and i got a requirement like writing a script and schedule it, so that it removes 30 days old files from all the log locations of a unix box. Suppose i have a unix server ltbamdev1 and in this server i have a mount point opt/bam. In this mount point i have 3... (1 Reply)
Discussion started by: duos
1 Replies

3. Shell Programming and Scripting

Purge files and archive

Hi Friends, I have an urgent requirement. I have many files huge in size which has occupied almost the entire disk space. The files are not being moved to the archived folder. But at present I need to purge those files, new to shell scripting, not sure how to proceed. Eg. Directory... (3 Replies)
Discussion started by: unx100
3 Replies

4. Shell Programming and Scripting

Script to delete older versions of unique files

I have directory where new sub directories and files being created every few minutes. The directories are like abc_date, def_date, ghi_date. I am looking to keep the latest 2 unique directories and delete everything else. Here is what I have so far This gives me unique names excluding the... (5 Replies)
Discussion started by: zzstore
5 Replies

5. Shell Programming and Scripting

Need a script to delete previous versions of files

Hi. I need a script (either bash or perl) that can delete previous versions of files. For instance, from our continuous build process I get directories such as build5_dev_1.21 build5_dev_1.22 build5_dev_1.23 build5_dev_1.24 I need a script that I can run every night (using "at"... (6 Replies)
Discussion started by: jbsimon000
6 Replies

6. Shell Programming and Scripting

Shell script to check the files hourly and purge

I'm new to shell scripting... i have been given a task.. can any one help in this regard.... 1) Check hourly for files in <destination-path><destination-file-template><destination-file-suffix> for files older than <destination-file-retention> days and purge. It should then check... (1 Reply)
Discussion started by: satishpabba
1 Replies

7. Shell Programming and Scripting

shell script preserving last 2 versions of files

I need some help with the logic and syntax for a shell script (ksh) that will search a directory and look for similar files and save only the last two versions. The version number is in the file name. However, the files are of varying name lengths and may have 1 or many files, with no limit to... (6 Replies)
Discussion started by: synergy_texas
6 Replies

8. Shell Programming and Scripting

Purge files based on timestamp avl in file name

Dear All, I have the followoing requirement.. REQ-1: Suppose I have the following files XX_20070202000101.zip XX_20080223000101.zip XX_20080226000101.zip XX_20080227000101.zip XX_20080228000101.zip XX_20080229000101.zip Suppose sysdate = 29 Feb 2007 I need to delete all files... (3 Replies)
Discussion started by: sureshg_sampat
3 Replies

9. UNIX for Dummies Questions & Answers

Find and purge a files in a dir

HI All, I have recuirement to purge the files in a directory . In that directory i an having many sub-directory . When i use find command like find ~/work/test/insert -name "*.*" -mtime +12 it is listing the file not accesed before 12 , It also takes the subdirectories inside the... (7 Replies)
Discussion started by: arunkumar_mca
7 Replies

10. Shell Programming and Scripting

ls latest 4 days or specify days of files in the directory

Hi, I would like to list latest 2 days, 3 days or 4 days,etc of files in the directory... how? is it using ls? (3 Replies)
Discussion started by: happyv
3 Replies
Login or Register to Ask a Question
uucleanup(1M)						  System Administration Commands					     uucleanup(1M)

NAME
uucleanup - uucp spool directory clean-up SYNOPSIS
/usr/lib/uucp/uucleanup [-Ctime] [-Dtime] [-mstring] [-otime] [-ssystem] [-Wtime] [-xdebug-level] [-Xtime] DESCRIPTION
uucleanup will scan the spool directories for old files and take appropriate action to remove them in a useful way: o Inform the requester of send/receive requests for systems that can not be reached. o Return undeliverable mail to the sender. o Deliver rnews files addressed to the local system. o Remove all other files. In addition, there is a provision to warn users of requests that have been waiting for a given number of days (default 1 day). Note: uucle- anup will process as if all option times were specified to the default values unless time is specifically set. This program is typically started by the shell uudemon.cleanup, which should be started by cron(1M). OPTIONS
-Ctime Remove any C. files greater or equal to time days old and send appropriate information to the requester (default 7 days). -Dtime Remove any D. files greater or equal to time days old, make an attempt to deliver mail messages, and execute rnews when appropriate (default 7 days). -mstring Include string in the warning message generated by the -W option. The default line is "See your local administrator to locate the problem". -otime Delete other files whose age is more than time days (default 2 days). -ssystem Execute for system spool directory only. -Wtime Any C. files equal to time days old will cause a mail message to be sent to the requester warning about the delay in con- tacting the remote. The message includes the JOBID, and in the case of mail, the mail message. The administrator may include a message line telling whom to call to check the problem (-m option) (default 1 day). -xdebug-level Produce debugging output on standard ouput. debug-level is a single digit between 0 and 9; higher numbers give more detailed debugging information. (This option may not be available on all systems.) -Xtime Any X. files greater or equal to time days old will be removed. The D. files are probably not present (if they were, the X. could get executed). But if there are D. files, they will be taken care of by D. processing (default 2 days). FILES
/usr/lib/uucp directory with commands used by uucleanup internally /var/spool/uucp spool directory ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Availability |SUNWbnuu | +-----------------------------+-----------------------------+ SEE ALSO
uucp(1C), uux(1C), cron(1M), attributes(5) SunOS 5.10 19 May 1993 uucleanup(1M)