Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Re: Find -mtime or -ctime from a Find module?

by RichardK (Parson)
on Sep 17, 2015 at 14:41 UTC ( [id://1142329]=note: print w/replies, xml ) Need Help??


in reply to Find -mtime or -ctime from a Find module?

Your shell problem sounds like you should be using xargs. something along these lines :-

find /tmp -name core -type f -print | xargs /bin/rm -f

Replies are listed 'Best First'.
Re^2: Find -mtime or -ctime from a Find module?
by afoken (Chancellor) on Sep 18, 2015 at 05:06 UTC
    find /tmp -name core -type f -print | xargs /bin/rm -f

    To avoid nasty surprises, change that to:

    find /tmp -name core -type f -print0 | xargs -0 /bin/rm -f

    This way, find uses a null char instead of a line feed to seperate filenames, and xargs expects a null char instead of any whitespace between filenames. As the null char is the only char that can not be part of a filename, this is the only way to reliably separate filenames.

    Alexander

    --
    Today I will gladly share my knowledge and experience, for there are no sweeter words than "I told you so". ;-)

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1142329]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others examining the Monastery: (6)
As of 2024-04-19 09:21 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found