11-13-2006
A solution is to use the
-newer expression of the
find command.
- Compute current date/time minus 5 mn
The Perderabo's datecalc and Simple date and time calculation in BASH may help you.
- Create a timestamp file with access and modification times equal to the computed date/time :
touch -t [[CC]YY]MMDDhhmm[.SS] timestamp_file
- Find files newer that the timestamp file.
find . -type f -newer timestamp_file -exec rm -f {} \;
Jean-Pierre.
10 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
need help with this ...
Find files older than 5 days and remove tem after listing
list "test" file older than 5 days and then remove them (1 Reply)
Discussion started by: ypatel6871
1 Replies
2. Red Hat
Hi,
I have dummies questions:
My script here can find the files in any directories older than 30 days then it will delete the files but not the directories. I would like to also be able to delete the directories that hold old files more than 30 days not just the files itself.
find . -type f... (2 Replies)
Discussion started by: lamoul
2 Replies
3. 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
4. Shell Programming and Scripting
Hello all,
Here's the deal...I have one directory with many subdirs and files.
What I want to find out is who is keeping old files and directories...say files and dirs that they didn't use since a number of n days, only one level under the initial dir. Output to a file.
A script for... (5 Replies)
Discussion started by: ejianu
5 Replies
5. 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
6. UNIX for Advanced & Expert Users
Hi Gurus,
I have command to delete more than 180days file.
find /home/abc/ -name "CBST_*.txt*" -mtime +180 | xargs -n 100 rm -f
Now I would like to delete more than 180days Non empty directory--What will be command?
Following is non empty directory as instance CBST2010* (2 Replies)
Discussion started by: thepurple
2 Replies
7. Shell Programming and Scripting
Hi All,
I am new to the scripting and using solaris 10 OS. Please suggest me from the below script which modifications need to be done to delete the files more that 2days older. Current script is deleting existing file.
# Remove old explorer runs if needed
DIR=`dirname ${EXP_TARGET}`
if ... (2 Replies)
Discussion started by: Navkreddy
2 Replies
8. UNIX for Dummies Questions & Answers
Hi all,
how to compress the directories which is older 7 days.
If any one knows please help me this is urgent.
Thanks in advance (3 Replies)
Discussion started by: rameshpagadala
3 Replies
9. Shell Programming and Scripting
Requirement is to list the files older than 365 days from multiple directories and delete them and log the list of files which are deleted to a log file.
so 1 script should only list files older than 365 days for each directory separately to a folder
The other script should read these files... (7 Replies)
Discussion started by: prasadn
7 Replies
10. Shell Programming and Scripting
Hi All,
Need help in identifying a shellscript command to remove all files on a server directory, starting with a certain prefix and also older than 3 days.
That means files created with that prefix, today or yesterday, shouldn't be removed.
Thanks,
Dev (3 Replies)
Discussion started by: dev.devil.1983
3 Replies
LEARN ABOUT HPUX
uucleanup
uucleanup(1M) uucleanup(1M)
NAME
uucleanup - uucp spool directory clean-up
SYNOPSIS
time] time] time] time] string] time] system] debug_level]
DESCRIPTION
The commands, including are targeted for removal from HP-UX; see the below.
scans the spool directories for old files and takes appropriate action to remove them. Depending on the options selected, performs the
following:
o Informs the requestor of send and/or receive requests for systems that cannot be reached.
o Returns mail that cannot be delivered to the sender.
o Removes all other files.
In addition, warns users of requestors who have been waiting for a given number of days (the default is 1 day). Note that unless time is
specifically set, the default time values for the following options are used.
Options
recognizes the following options:
Any files greater or equal to time days old are removed with appropriate information to the requestor. The default time
is 7 days.
Any files greater or equal to time days old are removed. An attempt is made to deliver mail messages and execute news
when appropriate. The default time is 7 days.
Any files equal to time cause a message to be mailed to the requestor warning about the delay in contacting the remote.
The message includes the JOBID, and in the case of mail, the mail message. The administrator can include a message
line telling who to call to correct the problem (see the option). The default time is 1 day.
Any files greater than or equal to time days old are removed. The files are probably not present (if they were, the
could be executed). But, if files are present, they are taken care of by processing. The default time is 2 days.
This string is included in the warning message generated by the
option. The default string is
Other files whose age is more than
time days are deleted. The default time is 2 days.
Clean-up the spool directory for
system only. The default is to clean-up all spool directories.
The debug level is a single digit between 0 and 9.
The higher the numbers, the more detailed the debugging information returned.
This program is typically started by the script which should be started by (see cron(1M)).
WARNINGS
Use of commands, including is discouraged because they are targeted for removal from HP-UX. Use ftp(1) or rcp(1) instead.
FILES
spool directory
SEE ALSO
cron(1M), uucp(1), uux(1), uuclean(1M).
Tim O'Reilly and Grace Todino,
O'Reilly & Associates, Inc. USA.
Grace Todino and Dale Dougherty,
O'Reilly & Associates, Inc. USA.
TO BE OBSOLETED uucleanup(1M)