Thanks! That worked well. I ultimately found the documentation about how glob doesn't like spaces, but I still struggle with Windows conventions, so you saved me much effort. As a side note (which I hope justifies top-posting), I ended up needing File::Find instead of a regular glob. Looking through CPAN and googling, I found several examples of more complex uses, but I never did find the simplest implementation of File::Find: to just list each file in each subdirectory. So here it is, for the next newbie who needs it:
use warnings; use strict; use File::Find; open (OUT, ">out.txt"); my $folder = "d:/Directory"; find (\&wanted, $folder); sub wanted { print OUT "$File::Find::dir/"; print OUT "$_\n"; } -Chris > -----Original Message----- > From: Perry, Alan [mailto:[EMAIL PROTECTED] > Sent: Wednesday, January 21, 2004 10:55 AM > To: 'McMahon, Chris'; [EMAIL PROTECTED] > Subject: RE: Help with fileglob: Unix vs. Windows? > > > On Wednesday, January 21, 2004 10:53, McMahon, Chris queried: > > > >But this script doesn't do right in Windows: > > Modify the code as shown, and it should work: > > >use warnings; > >use strict; > >my $dir = "E:\\Documents and Settings\\cmcmahon\\Desktop"; > > You have to escape the spaces, and for some reason, using > backslashes seems > to cause Perl problems here. And put the string in single > quotes, so the > backslash in front of the spaces is retained. So, change it > to read as > follows: > > my $dir = 'E:/Documents\ and\ Settings/cmcmahon/Desktop'; > > >print "$dir\n"; > >my @files = glob( "$dir\\*"); > > You need a forward slash here as well. > > my @files = glob("$dir/*"); > > >print @files; > > I would change this (only to make it look nicer, one filename > per line) to: > > print "$_\n" for @files; > > HTH, > Alan > -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>