Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Re: Shorten windows paths too long (qx)

by tye (Cardinal)
on Aug 17, 2010 at 18:38 UTC ( #855565=note: print w/ replies, xml ) Need Help??


in reply to Shorten windows paths too long

`H:; cd $olddirname; cd ..; move /Y $olddirname $newname` or die "Can' +t move $olddirname $newname: $!";

That is pretty broken code. `` (qx<>) doesn't return a boolean. It returns the output of the commands. So you are dieing if that command produces no output. And $! usually is irrelevant after qx() fails.

my $output= qx(H:; cd $olddirname; cd ..; move /Y $olddirname $newname +); if( 0 != $? ) { die "Can't move $olddirname $newname: $output"; }

Might be closer to correct.

- tye        


Comment on Re: Shorten windows paths too long (qx)
Select or Download Code
Re^2: Shorten windows paths too long (qx)
by gj2666 (Sexton) on Aug 18, 2010 at 15:45 UTC
    I stand corrected *blushing* I admit my code is remedial at best. I wasn't sure how to do that and gave my best guess. Thank you for the correction there. I'll fix my version per your recommendations.

    Thanks again,

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://855565]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (8)
As of 2015-07-03 22:32 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (57 votes), past polls