-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.
In reply to Re^3: Is there a -e test for directories, like there is for files?
by ikegami
in thread Is there a -e test for directories, like there is for files?
by mdunnbass
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |