Sisyphus wrote:

> Hi,
> 
> Can anyone make sense of this:
> 
> D:\math-mpfr\build58\cpan>type try.pl
> 
> use warnings;
> if(system("rmdir /S /Q Math-MPFR-1.07\\t")) {die "Failure"}

I would use File::Path::rmtree instead.

> D:\math-mpfr\build58\cpan>perl try.pl
> rmdir: `/S': No such file or directory
> rmdir: `/Q': No such file or directory
> rmdir: `Math-MPFR-1.07\\t': Directory not empty
> Failure at try.pl line 3.

If you have to use system, try adding the shell :

system "$ENV{COMSPEC} /C rmdir /S /Q Math-MPFR-1.07\\t" && die "rmdir $!: 
($^E)";

> D:\math-mpfr\build58\cpan>rmdir /S /Q Math-MPFR-1.07\t
> 
> D:\math-mpfr\build58\cpan>
> 
> Three things I do not understand:
> 
> 1) I have run try.pl as part of an automated procedure on the same machine,
> in the same shell, probably about 20 times in the past. Tonight is the first
> time it has decided to behave in a manner other than I expected;
> 
> 2) Why perl has suddenly decided that a backslash inside double quotes in a
> system() command no longer represents an escape;
> 
> 3) Why rmdir in the system command thinks that /S and /Q are folders, yet
> understands them perfectly when run from the command line.

Are you picking up another rmdir in your path ?  Maybe a UNIX version ?

> Two things have changed since I last ran this script:
> 
> 1) I've switched from perl5.8.6 to perl5.8.7 - but that's not the problem,
> because when I revert to 5.8.6 the same behaviour persists.
> 
> 2) I've run Windows Update a coupla times.
> 
> I'm also open to suggestions on how I might successfully run 'rmdir /S /Q
> Math-MPFR-1.07\t' as a system() command from perl. I tried the following
> (both of which produced the same nonsensical result as appears above):
> 
> use warnings;
> $command = 'rmdir /S /Q Math-MPFR-1.07\\t';
> if(system($command)) {die "Failure"}
> 
> use warnings;
> @command = ('rmdir', '/S', '/Q', 'Math-MPFR-1.07\\t');
> if(system(@command)) {die "Failure"}
> 
> I'm on Windows2000.
> 
> Aaah ... I've just now found a solution. If I change 'rmdir' to 'rd' it
> works fine - but I'll send this post anyway ... it might save someone else
> some agony. And I'm still completely in the dark as regards what's going on
> ... any explanations gratefully received.

Which leads you to believe there's another rmdir out there.

> Btw, here's what 'rmdir /?' reveals for me:
> 
> D:\math-mpfr>rmdir /?
> Removes (deletes) a directory.
> 
> RMDIR [/S] [/Q] [drive:]path
> RD [/S] [/Q] [drive:]path
> 
>     /S      Removes all directories and files in the specified directory
>             in addition to the directory itself.  Used to remove a directory
>             tree.
> 
>     /Q      Quiet mode, do not ask if ok to remove a directory tree with /S


-- 
  ,-/-  __      _  _         $Bill Luebkert    Mailto:[EMAIL PROTECTED]
 (_/   /  )    // //       DBE Collectibles    Mailto:[EMAIL PROTECTED]
  / ) /--<  o // //      Castle of Medieval Myth & Magic http://www.todbe.com/
-/-' /___/_<_</_</_    http://dbecoll.tripod.com/ (My Perl/Lakers stuff)
_______________________________________________
Perl-Win32-Users mailing list
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to