my test script:
my $loc = "\\\\ant\\d1_sp\\test__18716093";
####$loc = "c:\\temp"; #this works good if I un-comment.
system("dir $loc\\*.log"); #added system command just for debugging.
my @test = glob qq("$loc\\*.log");
print "\narray=@test\n";
I want to save the file names in $loc into array for further processing, but its not doing so, what am I missing? output is:
C:\>perl c:\temp\foo.pl
Directory of \\ant\d1_sp\test__18716093
03/14/2016 01:09 PM 959 build_1.8980.log
03/14/2016 01:20 PM 102,402 build_2.98981.log
2 File(s) 103,361 bytes
0 Dir(s) 1,589,522,239,488 bytes free
array=
C:\>
You want to list the .log
files in the following share:
\\ant\d1_sp\test__18716093
To do so, you need to use the following glob pattern:
\\\\ant\\d1_sp\\test__18716093\\*.log
The following is a string literal that produces that string:
"\\\\\\\\ant\\\\d1_sp\\\\test__18716093\\\\*.log"
So the solution is
glob("\\\\\\\\ant\\\\d1_sp\\\\test__18716093\\\\*.log")
Best to just use /
instead of \
since you don't need to escape it in either glob patterns or string literals.
glob("//ant/d1_sp/test__18716093/*.log")