Scott Whitney wrote: > os.rename(oldName,newName) gives: > > OSError: [Errno 18] Invalid cross-device link > > mv from the shell works fine. > > This is Python 2.2.3 from RedHat 9.0. > > Any suggestions (other than os.system('mv %s %s')?)
catch exception and copy if error == errno.EXDEV. (this is what "mv" does, of course) or use shutil.move: >>> import shutil >>> help(shutil.move) Help on function move in module shutil: 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. </F> -- http://mail.python.org/mailman/listinfo/python-list