Yes, that works, but when you start adding the full path which also includes spaces, it fails.
The issue is with getting the quoting and escaping set correctly for the shell.
c:\test>dir "C:\Music\Ray LaMontagne" Volume in drive C has no label. Volume Serial Number is 4CD3-F30A Directory of C:\Music\Ray LaMontagne 07/30/2015 02:31 PM <DIR> . 07/30/2015 02:31 PM <DIR> .. 07/30/2015 02:31 PM 0 2010 - God Willin' & The Creek +Don't Rise.txt 1 File(s) 0 bytes 2 Dir(s) 938,700,210,176 bytes free c:\test>type Perl-1.pl #!/usr/bin/perl use 5.010; use strict; use warnings; use Data::Dumper; # I created this full path for the test my $fn = q(C:\Music\Ray LaMontagne\2010 - God Willin' & The Creek Don' +t Rise); print $fn, $/; #my $fn = "this 'is' a text file.txt"; my @s = stat $fn; print Dumper \@s; c:\test>Perl-1.pl C:\Music\Ray LaMontagne\2010 - God Willin' & The Creek Don't Rise $VAR1 = [];
I've delt with this issue before and always need to run a bunch of tests to get the quoting/escaping correct.
In reply to Re^3: stat on file name containing single quotes
by fishmonger
in thread stat on file name containing single quotes
by perlpipe
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |