For Programmers: Free Programming Magazines  


Home > Archive > PERL Beginners > October 2006 > use of find2perl in perl script - problem









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author use of find2perl in perl script - problem
Kay

2006-10-13, 7:56 am

Hello,
I am finding it difficult to use find2perl. With the following code:
##################################
$dir="/usr/bin/home/test/a1";
$name="*";
$days=-1;

$command=`find2perl $dir -name "$name" -mtime +$days -print | perl >
k1.out`;

$command=`find2perl $dir -name "$name" -mtime +$days -exec rm {} \; >
findit.pl`;
$command=`perl findit.pl`;
################################
k1.out gives the perl code for find alright. But findit.pl created does
not contain any code and thus refuses to remove the desired lines.
Strangely it does not give any errors. I modified the above as below:

$dir="/usr/bin/home/test/a1";
$name="*";
$days=-1;

$command=`find2perl $dir -name "$name" -mtime +$days -print | perl >
k1.out`;

$command=`find2perl $dir -name "$name" -mtime +$days -exec rm {} >
findit.pl`;
$command=`perl findit.pl`;
####################################
And k1.out gives me the perl code for find just like before. Also the
next find2perl use removes my files as desired. But also gives the
following error:

error::
/usr/bin/home/test/a1: Invalid argument

Where am I going wrong?
Any help is deeply appreciated!!
Kay

Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2009 codecomments.com