+ 2
Move files with the os module
How can I move files using the os module without knowing which system the user uses?
2 ответов
+ 3
Windows has REName, and I believe you can rename across file systems, which causes a move. Linuxes went with the more representative 'mv' (move) with no 'rename' command.
On both, this is what happens:
* same filesystem [logical rename looks like a move]
Just relinks the file reference
* different filesystem [physical move with optional rename]
Copy, OPTIONAL verify, delete old copy
I don't have Windows to test, but I think this is worth checking::
import os
print(os.rename.__doc__)
Manually:
os.read, os.write, os.unlink
+ 2
Thanks