Moving a file to another directory in Perl? -


rename $argv[0], $argv[1] or warn "rename fails: $!\n"; 

when run ./programe file.txt dir/ fails.

what's wrong here?

from perldoc rename:

behavior of function varies wildly depending on system implementation. example, not work across file system boundaries, though system mv command compensates this. other restrictions include whether works on directories, open files, or pre- existing files. check perlport , either rename(2) manpage or equivalent system documentation details.

for platform independent "move" function @ file::copy module.

so use file::copy::move instead.


Comments

Popular posts from this blog

c++ - Is it possible to compile a VST on linux? -

c# - SharpSVN - How to get the previous revision? -

php cli reading files and how to fix it? -