implementing mv

Jeff Epler jepler at
Wed Dec 24 15:54:27 CET 2003

You should look at the 'shutil' module.  It provides a move() function.

$ pydoc shutil.move
Help on function move in shutil:

shutil.move = move(src, dst)
    Recursively move a file or directory to another location.
    If the destination is on our current filesystem, then simply use
    rename.  Otherwise, copy src to the dst and then remove src.
    A lot more could be done here...  A look at a mv.c shows a lot of
    the issues this implementation glosses over.
(I assume mv.c is the source for the unix "/bin/mv" utility, available
in multiple incarnations)


More information about the Python-list mailing list