Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re^3: stat on file name containing single quotes

by fishmonger (Chaplain)
on Jul 30, 2015 at 21:40 UTC ( [id://1136935]=note: print w/replies, xml ) Need Help??


in reply to Re^2: stat on file name containing single quotes
in thread stat on file name containing single quotes

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.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1136935]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others contemplating the Monastery: (3)
As of 2024-04-24 18:50 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found