判断方法: DirectoryInfo di = new DirectoryInfo(path); if ((di.Attributes & FileAttributes.Hidden) == FileAttributes.Hidden) //为隐藏的 同理可以判断目录是否为只读(ReadOnly)或者系统(System)等其他属性.
1.数组相等,数组成员相同,位置也相同 一般的如果判断@array1 等于 @array2 a.数组长度相同 $#array1=$#array2, 比较数组长度,不能使用length函数,length只适用string类型 数组参数传递,不能直接传递 sub compare() { ; my ($first,$second)=@_; if (@$first==@$second) # the number of the array , don't use length() { ;$i<@$firs
更多 #!/usr/bin/perl # 递归打印目录结构 use v5.26; use strict; use utf8; use autodie; use warnings; use Encode qw(decode encode); use File::Spec::Functions; use File::Basename; use experimental 'smartmatch'; # 忽略智能匹配的错误警告 use Getopt::Long qw(GetOptions); use T
FUNCTION WritableDir(CONST Dir : STRING) : BOOLEAN; VAR FIL : FILE; N : STRING; I : Cardinal; BEGIN REPEAT N:=IncludeTrailingPathDelimiter(Dir); FOR I:= TO -LENGTH(N) DO N:=N+CHAR(RANDOM()+) UNTIL NOT FileExists(N); Result:=TRUE; TRY AssignFile(FIL,N
#!/usr/bin/perl -w use strict; use File::Spec; local $\ ="\n";#当前模块的每行输出加入换行符 my %options; #目录路径 $options{single_case} = '/home/jiangyu/src/pl/Example'; my @cases; if (-d $options{single_case}) {#判断目录是否存在 my @files; my $dh; push(@files, $options