in reply to Redirecting errors
Assuming you meant 'system("id...") or system("echo...");' then the problem may be a misunderstanding of what a shell process should normally return: zero if command was successful, non-zero otherwise. Maybe you want to try 'and' rather than 'or' between the 'system()' calls; if the first system calls returns with zero (meaning success), the second will not be executed.
You may also want to simplify your syntax a bit, and use one less system call per iteration (since these tend to slow things down):
open( ERRLOG, ">>c:\\error.txt" ); foreach (@DIR) { print "$directory\\$_\n"; system("echo $directory\\$DIR[$a] >> c:\\dump.txt"); system("identify -verbose $directory\\$_ >> c:\\dump.txt") and print ERRLOG "ERROR: $directory\\$_\n"; }
|
|---|