in reply to Re: Re: Re: Using * character to open all Files in the directory
in thread Using * character to open all Files in the directory

Yes Windows forbids the use of numerous characters including several non while cards such as : and '. In UN*X you escape the wild character to protect it, same idea as in Perl.

--
perl -pew "s/\b;([mnst])/'$1/g"

  • Comment on Re: Re: Re: Re: Using * character to open all Files in the directory

Replies are listed 'Best First'.
Re: Re: Re: Re: Re: Using * character to open all Files in the directory
by BrowserUk (Patriarch) on Jul 06, 2002 at 02:17 UTC

    Actually, I already know what chars windows does/doesn't allow in filenames. Your assumption is slightly wrong though, vis.

    C:\test>echo .>' C:\test>dir Volume in drive C has no label. Volume Serial Number is 8C87-E163 Directory of C:\test 02/08/20 02:55a <DIR> . 02/08/20 02:55a <DIR> .. 02/08/20 02:55a 3 ' <<<<<! 02/08/13 03:12p 210 178232.pl

    In an earlier thread the following:

    ... @ARGV = map glob, @ARGV; ...

    was advised against because "someone might pass in an escaped (eg.what\*ever) filename containing glob chars", and that might cause the above snippet to "break" on *nix environments. I thought then and I am asking now:

    1) Why would anyone wish to embed "*" in a filename? Other than shear perversity.

    2) How would this break?

    Surely, globbing filespec of "what\*ever" is going to match the file named "what*ever"? Granted it might also match "whatifever" etc. but (see Q.1).

    I guess I accept that OS's in general (*nix included) have to reserve some chars in filenames and other system entities (try creating a file "feet/sec" on *nix?).

      Right "'" is allowed, D'oh. TANJ. But there are still others. Who are we to say what the user should do? :-P But no, seriously "?" would probably be used quite often, what with the apparent trend of end users to put the file's contents in its name. "*" in filenames might be used to either draw attention to the file, or to make them harder to delete. If you type rmv -rf what\*ver you don't exactly expect whatever to go bye-bye...

      --
      perl -pew "s/\b;([mnst])/'$1/g"