1832299 Members
1988 Online
110041 Solutions
New Discussion

RM filesets

 
SOLVED
Go to solution
Adam Winebaugh
Regular Advisor

RM filesets

Everyone, this is going to be some easy points I think. I am just not smart enough to figure it out.

I am runnning HP-UX 11.11 and I need to remove about 900 files out of 20,000. However I need to only remove the files that were created within a specific date range. Ideas?
5 REPLIES 5
James R. Ferguson
Acclaimed Contributor

Re: RM filesets

Hi Adam:

# touch -amt 04150000 /tmp/ref1
# touch -amt 04202359 /tmp/ref2

# find /path -xdev -type f -newer /tmp/ref1 -a ! -newer /tmp/ref2 -exec rm {} \+

This will remove files that are newer (more recently modified) than April 15 at 0000 AND NOT newer than April 20 at 2359.

Regards!

...JRF...
Adam Winebaugh
Regular Advisor

Re: RM filesets

At which point in that suntax would I add years?
James R. Ferguson
Acclaimed Contributor
Solution

Re: RM filesets

Hi (again):

> At which point in that suntax would I add years?

see the manpages for 'touuch':

# touch -mt [[CC]YY]MMDDhhmm[.SS] /tmp/ref1

For example:

# touch -mt 199904010000.00 /tmp/ref1
# touch -mt 200712312359.59 /tmp/ref2

Regards!

...JRF...
Adam Winebaugh
Regular Advisor

Re: RM filesets

James,
As usual you are right on. Thanks for the help. I appreciate it. You rock.
Paul Sperry
Honored Contributor

Re: RM filesets

The year would be in the refernece files

From man touch:



-t time Use the specified time instead of the current time.
The option argument is a decimal number of the form

[[CC]YY]MMDDhhmm[.SS]

where each two digits represents the following:

CC The first two digits of the year.

YY The second two digits of the year.

MM The month of the year (01-12).

DD The day of the month (01-31).

hh The hour of the day (00-23).

mm The minute of the hour (00-59).

SS The second of the minute (00-61).

If neither CC nor YY is given, the current year is
assumed. If YY is specified, but CC is not, CC is
derived as follows: (taken into account the local time
factor)

If YY is: CC becomes:
_______________________
69-99 19
00-68 20


If the resulting time value precedes the Epoch
(00:00:00 January 1, 1970 Greenwich Mean Time), touch
exits immediately with an error status.

The range for SS is 00 through 61 rather than 00
through 59 to accommodate leap seconds. If SS is 60 or
61, and the resulting time, as affected by the TZ
environment variable, does not refer to a leap second,
the resulting time is one second after a time where SS
is 59. If SS is not given a value, it is assumed to be
0.