in reply to Re^2: Is there a -e test for directories, like there is for files?
in thread Is there a -e test for directories, like there is for files?
-e $backful
Update: Specifically, replace
withopendir (DIR, $backupdir) or die $!; my @files = readdir DIR; print "\@files is: \n"; foreach (@files) { print $_, "\n"; } if (grep {$back} @files) { print "Backup copy of $filename exists!\n"; } else { copy($filename, $backful); print "Backup copy of the file has been created\n"; }
if (-e $backful) { print "Backup copy of $filename exists!\n"; } else { copy($filename, $backful); print "Backup copy of the file has been created\n"; }
You should check whether the backup is the same, not whether it exists.
You should check whether the copy succeeded.
You should fix up your indenting.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: Is there a -e test for directories, like there is for files?
by mdunnbass (Monk) on Feb 08, 2007 at 21:15 UTC | |
by johngg (Canon) on Feb 08, 2007 at 23:51 UTC | |
by ikegami (Patriarch) on Feb 08, 2007 at 21:18 UTC |