I am trying to move a directory using perl within the same volume in ubuntu.
I used the move ( File::Copy ) command in Perl like below
move($dir1, $dir2);. # Doesn't work.
Expecation is that $dir1 will be place under $dir2 after the move. But got an error saying that 'Is a directory'.
But when I use system mv it works perfectly.
system("mv $dir1 $dir2"); #This works!.
I searched google and understood that move should works exactly like mv in linux?. Any ideas?
If you want to move the directory ./dir1
under ./dir2
call move like this:
move("./dir1", "./dir2/dir1");
I think you are doing:
move("./dir1", "./dir2/");
which complains because ./dir2
already exists.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With