[Tutor] moving directories into directories
Alan Gauld
alan.gauld at btinternet.com
Thu Nov 12 10:10:37 CET 2009
"Christopher Spears" <cspears2002 at yahoo.com> wrote
> I'm trying to move a bunch of files and directories into another
> directory.
> Unfortunately, I keep getting an error message:
> OSError: [Errno 17] File exists: './TAPE_ARCHIVES'
>
> The problem seems to happen when I try to move a directory into another
> directory:
I think what is happening is that you are trying to copy something that
has an equivalently named item already existing in the target. When
you do this at a UI the OS asks if you want to replace it, but in a program
it can't do that so it throws the exception. You need to handle that case
by
catching the exception and ignoring it, or stopping or whatever.
HTH,
--
Alan Gauld
Author of the Learn to Program web site
http://www.alan-g.me.uk/
More information about the Tutor
mailing list