Hi all,
I've searched the net for a while, and tried a lot of things. The script I wrote prints the contents of a directory. It works fine for a directory with no space in it, but with a space it doens't. I tried putting in qoutation marks, but that doesn't help. Anyone some ideas?
I've searched the net for a while, and tried a lot of things. The script I wrote prints the contents of a directory. It works fine for a directory with no space in it, but with a space it doens't. I tried putting in qoutation marks, but that doesn't help. Anyone some ideas?
Code:
#!/usr/bin/perl -w
my $dir = 'c:\Documents and Settings\\\';
@files = <$dir*>;
foreach $file (@files) {
if (-d $file) {
print "$file [DIR]\n";
} else {
my $filesize = -s $file;
print "$file [$filesize]\n";
}
}
Comment