Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Re^2: Move a file to another directory based on regex match

by Corion (Patriarch)
on Feb 25, 2021 at 15:16 UTC ( [id://11128787]=note: print w/replies, xml ) Need Help??


in reply to Re: Move a file to another directory based on regex match
in thread Move a file to another directory based on regex match

In fact, the documentation about readdir mentions the fact that you need to prepend the directory again.

Just in the (very unlikely) case that the files actually exist, the error message suggests that the OP is trying to move them across mount points. This would happen for example if you have two disks mounted below /mount:

/mount/hda/dir1 /mount/hdb/dir2

Then, moving files from /mount/hda/dir1 to /mount/hdb/dir2 would mean actually copying the bytes between the two devices. At least the mv program (and thus, maybe also the rename() syscall?) on my Debian system does such copying nowadays...

Replies are listed 'Best First'.
Re^3: Move a file to another directory based on regex match
by haukex (Archbishop) on Feb 25, 2021 at 15:25 UTC
    actually copying the bytes between the two devices. At least the mv program (and thus, maybe also the rename() syscall?) on my Debian system does such copying nowadays...

    It's a good thing OP is using File::Copy, since that actually does copy the bytes (and only when necessary, AFAIK) - I belive this is what the OS's mv does too. I just tried rename across filesystems and did in fact get the Invalid cross-device link error.

Re^3: Move a file to another directory based on regex match
by choroba (Cardinal) on Feb 25, 2021 at 17:12 UTC
    So maybe the detection of the sameness of the device doesn't work correctly in MSWin?

    map{substr$_->[0],$_->[1]||0,1}[\*||{},3],[[]],[ref qr-1,-,-1],[{}],[sub{}^*ARGV,3]

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others learning in the Monastery: (3)
As of 2024-04-20 01:40 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found