解决方法
与所有事情一样,解决方案是perl脚本:
#!/usr/bin/perl use File::Find; my $directory1 = '/tmp/temp1'; my $directory2 = '/tmp/temp2'; find(\&hashfiles,$directory1); sub hashfiles { my $file1 = $File::Find::name; (my $file2 = $file1) =~ s/^$directory1/$directory2/; my $mode1 = (stat($file1))[2] ; my $mode2 = (stat($file2))[2] ; my $uid1 = (stat($file1))[4] ; my $uid2 = (stat($file2))[4] ; print "Permissions for $file1 and $file2 are not the same\n" if ( $mode1 != $mode2 ); print "Ownership for $file1 and $file2 are not the same\n" if ( $uid1 != $uid2 ); }
有关详细信息,请查看http://perldoc.perl.org/functions/stat.html和http://perldoc.perl.org/File/Find.html,特别是如果要比较其他文件属性,请查看统计信息.