When you say "a file is the same" do you mean the file name or the file contents?
This will compare based on the file name (UNTESTED):
#!/usr/bin/perl use warnings; use strict; my $tempdir = 'c:/Temp/OneFile'; my $permdir = 'c:/Support/Files'; opendir my $TMP, $tempdir or die "Cannot opendir '$tempdir' $!"; my @onefile = grep -f "$tempdir/$_", readdir $TMP; closedir $TMP; if ( @onefile > 1 ) { die "Error: more than one file in $tempdir\n"; } if ( -f "$permdir/$onefile[0]" ) { rename "$tempdir/$onefile[0]", "$tempdir/$onefile[0]_1.txt" or die + "Cannot rename '$tempdir/$onefile[0]' to '$tempdir/$onefile[0]_1.txt +' $!"; } exit 0; __END__
In reply to Re: comparing folders
by jwkrahn
in thread comparing folders
by grmshw4
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |