Title: RE: system("rmdir...") not working like it once did

I had the same issue and tracked it down to multiple versions of rmdir on my PC. The one in the path wasn't necessarily the one that PERL was trying to use. Once I explicitly set it to use d:\utils\rmdir (or whatever) things were OK again..

I had also patched recently, maybe this is the cause ?

regards,

Conor

------------------------------------------
Conor Lillis
------------------------------------------
Systems Administrator,
Infrastructure,
Davy
49 Dawson St.,
Dublin 2.

http://www.davy.ie
Direct : +353 1 614 90 13
Switch : +353 1 672 42 00
FAX : + 353 1 679 6334
------------------------------------------


-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] On Behalf Of Sisyphus

Sent: 06 September 2005 13:20
To: perl-win32-users
Subject: system("rmdir...") not working like it once did

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"}

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.

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.

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.

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

Cheers,
Rob

_______________________________________________
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs



The information in this e-mail is confidential and may be legally privileged. It is intended solely for the addressee. Access to this e-mail by anyone else is unauthorised. If you are not the intended recipient, any disclosure, copying, distribution or any other action taken or any views, opinions or advice contained in this e-mail are those of the sending individual and not necessarily those of the firm. It is possible for data transmitted by e-mail to be deliberately or accidentally corrupted or intercepted. For this reason where the communication is by e-mail, J&E Davy does not accept any responsibility for any breach of confidence which may arise from the use of this medium. If you have received this e-mail in error please notify us immediately at mailto:[EMAIL PROTECTED] and delete this e-mail from your system.
_______________________________________________
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to