大佬教程收集整理的这篇文章主要介绍了linux – 比较两个文件夹内容的所有者和权限?,大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
#!/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,特别是如果要比较其他@L_772_0@属性,请查看统计信息.
以上是大佬教程为你收集整理的linux – 比较两个文件夹内容的所有者和权限?全部内容,希望文章能够帮你解决linux – 比较两个文件夹内容的所有者和权限?所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。