[prog] Perl and find(1)

Almut Behrens almut-behrens at gmx.net
Mon Dec 11 05:46:29 UTC 2006


On Mon, Dec 11, 2006 at 02:46:13PM +1100, Chris Henderson wrote:
> I wrote this script which will go inside some directories and delete
> files but the find(1) command says "-exec" missing. Is it because I'm
> not parsing ls correctly?
> 
> (...)
> system "find @directories -atime +14 -name \"*.tgz\" -print
         -exec ls -al {} \\;";
                         ^

You need _two_ backslashes before the semicolon, so a literal backslash
is being passed through to the shell -- with only one backslash you're
just (uselessly) escaping the semicolon...

Cheers,
Almut

("find ..." command on one line, of course)



More information about the Programming mailing list