develooper Front page | perl.beginners | Postings from February 2002

file names with spaces in perl

Thread Next
From:
Johnson, Shaunn
Date:
February 27, 2002 08:03
Subject:
file names with spaces in perl
Message ID:
73309C2FDD95D11192E60008C7B1D5BB0452E012@snt452.corp.bcbsm.com
Howdy:

I'm having a problem with trying to get
a list of files with spaces in them.

I'm writing a perl script that goes into
a directory, get a list of files with spaces
in them (this is a file.doc) and run a
mkisofs command against it.

I can get a list of the files:

[example]

$debug=2;
foreach $cmd (`ls -1 $report_dir`)

[/example]

This *looks* like it gives me what i want (a list
of directories that have spaces in them, but
when i try something like this:

[example]

 {
        $mkisofs -f -J -r -hide-joliet-trans-tbl -V 'Report' -T -v -o
'$iso_dir/$cmd.iso' "$report_dir";
        }
__END__
[/example]

I get more errors that look like this:

[errors]

/usr/bin/mkisofs: No such file or directory. Invalid node -
/s/Profiling2/report/03/IHC0047
+ /usr/bin/mkisofs -f -J -r -hide-joliet-trans-tbl -V Reports -T -v -o
/s/Profiling2/iso/03/JACKSON.iso /s/Profiling2/report/03/JACKSON

[/errors]

The first part (No such file or directory) I
believe is about the <file.iso> not being comleted.  
The full name of the file is still chopped up and give 
me errors.

My question: How can I capture the ENTIRE file / directory 
name and use that variable when I execute my commands?

(Sorry this seems to be a long email)

Thanks!

-X

Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About