in reply to Re^7: Bugs in File::Find on Windows
in thread Bugs in File::Find on Windows

Excuse me if I misunderstood you.  I thought that's what you were trying to do when you said (above) to do:

To change the current dir of a drive without changing the current drive:

my $drive = substr(getcwd(), 0, 2); chdir('C:\\'); chdir($drive);

It seems like you were trying to change directory based on the 'C:\\' path, and then change drives (eg. to 'D:\\').  Maybe you meant that as 3 separate (unrelated) commands?  In which case, sorry, but it wasn't clear to me what you were trying to do.


s''(q.S:$/9=(T1';s;(..)(..);$..=substr+crypt($1,$2),2,3;eg;print$..$/

Replies are listed 'Best First'.
Re^9: Bugs in File::Find on Windows
by ikegami (Patriarch) on Feb 16, 2007 at 15:42 UTC

    No, it's one command.

    DOS:

    >cd E:\ >cd c: C:\Work >cd c:new >cd E:\ >cd c: C:\Work\New

    Perl equivalent:

    print(getdcwd(), "\n"); # cd -> E:\ print(getdcwd('c:'), "\n"); # cd c: -> C:\Work { # cd c:new my $drive = substr(getcwd(), 0, 2); chdir('c:new'); chdir($drive); } print(getdcwd(), "\n"); # cd -> E:\ print(getdcwd('c:'), "\n"); # cd c: -> C:\Work\New

    cd will not change the current drive.
    chdir will.
    I'm showing how to change the working dir on a drive without changing to that drive, like cd does.