in reply to Delete files with Perl in Windows
You need to escape spaces in a glob spec unless you want them to be treated as pattern seperator.
>perl -le"print for glob '*.jpg *.gif'" a.jpg b.jpg c.gif >perl -le"print for glob 'C:/Documents and Settings/*'" C:/Documents and >perl -le"print for glob 'C:/Documents\ and\ Settings/*'" C:/Documents and Settings/All Users C:/Documents and Settings/Default User C:/Documents and Settings/ikegami C:/Documents and Settings/kaijugal C:/Documents and Settings/LocalService C:/Documents and Settings/NetworkService
Alternatively, use bsd_glob from File::Glob.
>perl -le"use File::Glob qw( bsd_glob ); print for bsd_glob 'C:/Docume +nts and Settings/*'" C:/Documents and Settings/All Users C:/Documents and Settings/Default User C:/Documents and Settings/ikegami C:/Documents and Settings/kaijugal C:/Documents and Settings/LocalService C:/Documents and Settings/NetworkService
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Delete files with Perl in Windows
by codeacrobat (Chaplain) on Nov 30, 2007 at 06:41 UTC | |
by ikegami (Patriarch) on Nov 30, 2007 at 08:58 UTC | |
by halley (Prior) on Nov 30, 2007 at 14:21 UTC | |
by ikegami (Patriarch) on Nov 30, 2007 at 19:52 UTC |