newbie: windows xp scripting

Tim Roberts timr at probo.com
Wed May 24 01:07:54 EDT 2006


"oscartheduck" <oscartheduck at gmail.com> wrote:
>
>It wasn't, but after seeing your success I discovered what was wrong.
>My destination directory didn't exist, and for some reason windows
>wasn't automatically creating it to dump the files in.

Right.  The "copy" command never creates directories.  It will copy each
individual file, in turn, to a file with whatever the last name in the list
is.  Not terribly useful, but it is a behavior inherited from DOS 1.

On the other hand, the "xcopy" command will do it:

  xcopy /i C:\DIR1 C:\DIR2

That will create DIR2 if it does not already exist.

>I could fix this with a nested if statement, but it "feels" like
>windows should be creating this folder automatically if it doesn't
>exist.

What "feels" right is rarely a good reference for a command's behavior,
especially on Windows.
-- 
- Tim Roberts, timr at probo.com
  Providenza & Boekelheide, Inc.



More information about the Python-list mailing list