Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things

Re: Deleting Files

by RobPayne (Chaplain)
on Oct 07, 2006 at 19:17 UTC ( #576893=note: print w/replies, xml ) Need Help??

in reply to Deleting Files

Joost and the others have already provided working examples of tools which do what you have asked. The caveat with this operation is to be careful enough to not get bitten by the same types of bugs that have bitten others in this case. (You need to make sure that you adequately escape special characters in file names, quoting spaces, etc. so you don't, for example, call rm on a file named "/server/dir /etc/passwd" with that space in the name. You didn't mention what platform you were running on, but you might want to take a look at utilities that have already solved this problem and have already learned some of the lessons associated with this operation. One such utility is 'tmpwatch', which is included with redhat-based linux distros.

Tmpwatch uses -atime instead of -mtime as the basis for how old a file is and whether it is ready to be deleted. That way you don't remove files that haven't been written to, which are still being read by current processes.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://576893]
[Tux]: None work for me. My dead key is AltGr (right Alt)
[Tux]: And I just tested, neither do other Tk apps :) (95% of my Tk Apps is either just monitoring (no input) or input of just numbers). Something to investigate then
[choroba]: Maybe something like this?
[choroba]: I vaguely remember we had problems with dead keys in Tk at $work - 2, but I forgot all the details
[choroba]: but it was worse on MSWin than on Linux
[choroba]: (and OSX didn't exist yet)

How do I use this? | Other CB clients
Other Users?
Others wandering the Monastery: (9)
As of 2017-09-25 20:45 GMT
Find Nodes?
    Voting Booth?
    During the recent solar eclipse, I:

    Results (290 votes). Check out past polls.