Re: Deleting files older than 24 hours
From: Jerry.W (icesummit_at_sina.com)
Date: 06/13/03
- Next message: Bongo: "Re: merge more than 10 files side by side"
- Previous message: Tim Hammerquist: "Re: Deleting files older than 24 hours"
- In reply to: Tim Hammerquist: "Re: Deleting files older than 24 hours"
- Next in thread: manfred.leopold_at_documentum.com: "Re: Deleting files older than 24 hours"
- Reply: manfred.leopold_at_documentum.com: "Re: Deleting files older than 24 hours"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]
Date: Fri, 13 Jun 2003 16:54:56 +0800
BTW, you will not be able to know the creation time of a file. It isn't
stored.
Jerry.W
"Tim Hammerquist" <tim@vegeta.ath.cx> wrote in message
news:slrnbej2f2.s3d.tim@vegeta.ath.cx...
> manfred.leopold@documentum.com graced us by uttering:
> > sorry but I'm just a little bit confused.
> > Seems to be a simple question, but I don't find the way.
> >
> > I'm trying to get a shell-script for doing the following:
>
> This smells of homework, but you shouldn't need a shell script
> for these in any case. Let me see:
>
> > 1. deleting all files in a specified directory
>
> You should be able to accomplish this with just the rm(1)
> command, a directory, and maybe some wildcards. See `man rm`.
>
> # absolute path
> $ rm /path/to/some/dir/*
> # relative path
> $ rm sub/ordinate/dir/*
>
> > 2. deleging all files in a specified directory which are older
> > than 24 hours.
>
> For this, you almost certainly want find(1). The syntax can be
> daunting, but find is one of the most powerful commands you can
> find on any *nix system. You could also easily use the find
> comand to accomplish task 1 above.
>
> One warning, though: you'll need to define the "age" of a file.
> Do you want files which haven't been accessed (ie, read) in over
> 24 hours? Or files which haven't been modified (ie,
> written/changed) in over 24 hours? Or files which were *created*
> over 24 hours ago? These would be specified to the find(1)
> command as atime, mtime, and ctime, respectively.
>
> Finally, the action you want find(1) to take on each file it
> finds can be piped to a second command, or passed to a command
> specified by the -exec argument.
>
> The destination would be `man find`.
>
> HTH,
> Tim Hammerquist
> --
> Remember, kids. With great power comes
> great opportunity to *abuse* that power.
> -- Black Mage, 8-bit Theatre <http://nuklearpower.com/>
- Next message: Bongo: "Re: merge more than 10 files side by side"
- Previous message: Tim Hammerquist: "Re: Deleting files older than 24 hours"
- In reply to: Tim Hammerquist: "Re: Deleting files older than 24 hours"
- Next in thread: manfred.leopold_at_documentum.com: "Re: Deleting files older than 24 hours"
- Reply: manfred.leopold_at_documentum.com: "Re: Deleting files older than 24 hours"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]
Relevant Pages
|