Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Deleting old files

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
I'm new to Unix so apologies for this simple question.

How can I delete files that are older than three days and end in .SPL


I'd like this as part of a series of commands. I've been through the manuals and can't find a simple answer.

 
Malc72p

I have posted one possible solution to this problem on the SCO forum.


Regards

 
Malc,

you could try:

find . -mtime +3 -name '*.SPL' -exec rm {} \;

the -mtime is the modification time of the file, the +3 specifies more than 3 days old, the -name finds files named <something>.SPL and the -exec rm removes them. The above command assumes you're in the directory from which you want to delete the files.

Be careful with rm!!!!

Hope this helps.
 
rm -i does it interactively, so if you ever needed to be sure you could:
alias rm &quot;/bin/rm -i&quot;

it'll then prompt you for each file ...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top