Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re: move command

by Corion (Patriarch)
on Jul 08, 2009 at 06:42 UTC ( [id://778133]=note: print w/replies, xml ) Need Help??


in reply to move command

Don't start an external program when Perl has a fine built-in that has no problems with special characters - see rename:

use strict; my $filename = 'new&name.txt'; rename $filename => "new&filename_renamed.txt";

Replies are listed 'Best First'.
Re^2: move command
by hobbs (Monk) on Jul 08, 2009 at 06:49 UTC
    rename has limitations -- in particular, on most systems it will only work if the source and destination are on the same filesystem. File::Copy::move will use rename if it's appropriate, or do a copy-and-delete if rename won't work, so it's a more flexible solution.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others chanting in the Monastery: (5)
As of 2024-04-19 11:49 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found