moving a file in a filesystem-independent way?

Inyeol Lee inyeol.lee at siimage.com
Thu Jan 30 18:42:36 EST 2003


On Thu, Jan 30, 2003 at 04:29:34PM -0700, Fernando Perez wrote:
> Hi all,
> 
> I've stumped myself today with a seemingly silly problem, and I'd like to 
> hear a bit from the experts.
> 
> I need to move a file from A to B, under Linux. Simple enough task, use 
> os.rename(A,B).  Right? 
> 
> Wrong.
> 
> Depending on whether A and B are located on the same filesystem or not, the 
> call may fail with a nice 
> 
> OSError: [Errno 18] Invalid cross-device link
> 

shutil.move(src, dst), new in 2.3

Inyeol...





More information about the Python-list mailing list