I'm searching for the parent directory containing a specific file type using File::Find. I then want to ls -l on that directory and redirect the output to APPEND into a named file somewhere.
The problem... I could create a string with the command for each directory (and that does the redirect), but... Some of the parent directory names contain shell meta chars (sometimes).
So if I read the system help correctly, I must use the args as an array to prevent shell meta char interpretation. Well that works. But now my redirect is broken. Now ls complains it can't find a file called '>>'
What do I do to fix this ?
# use File::Find; # find(\&get_this,"."); # sub get_this { if( -d $_ ) { opendir(DIZ,$_); DIREL: while( $del = readdir(DIZ) ) { if( $del =~ m/\.xxx$/ ) { print "$File::Find::name\n" ; $File::Find::prune = 1; system("echo \"----------------------------------------------- +--\" >> \"/Volumes/Expansion\ Drive/stuffTGZ/list_xxx_dirs.txt\""); system("echo \"- $File::Find::name --------------------------- +--\" >> \"/Volumes/Expansion\ Drive/stuffTGZ/list_xxx_dirs.txt\""); my @syscmd = ("/bin/ls","-l","$File::Find::name",">>","/Volume +s/Expansion\ Drive/stuffTGZ/list_xxx_dirs.txt") ; system(@syscmd); last DIREL; } } closedir(DIZ); } }
BTW, does it make any difference bieng on iMac OSX ? thanks
In reply to Another system redirect problem by trendle
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |