[NTLUG:Discuss] Bash command
Kelledin
kelledin+NTLUG at skarpsey.dyndns.org
Fri Jul 23 21:30:58 CDT 2004
On Friday 23 July 2004 08:45 pm, Dennis wrote:
> I am attempting to create a dual command to delete files, such
> that I search for files greater than n days (find -atime +n)
> and then deleting them (rm -f). I have attempted several
> alternatives of the command, but not working.
>
> I have tried :
> rm -f < $(find -atime +5)
> find -atime +5 | $(rm -f)
> and a few other variations. Know the solution is obvious to
> the knowledgeable.
>
> Suggestions please.
find -atime +5 -exec rm -f '{}' \;
That instructs find to invoke rm -f on every file it finds, with
the filename substituted for '{}'. The semicolon is necessary
to terminate the -exec bit, and it's also VERY necessary to
escape that semicolon with a backslash!
--
Kelledin
"If a server crashes in a server farm and no one pings it, does
it still cost four figures to fix?"
More information about the Discuss
mailing list