Jump to content

FileCopy bug or expected behaviour?


Recommended Posts

#Include <WinAPI.au3>
$a = FileCopy("D:\flp.img", "H:\boot\bcd", 8)
ConsoleWrite($a & @CRLF & _WinAPI_GetLastErrorMessage() & @CRLF)

If a file H:boot already exists, FileCopy fails with "The directory name is invalid.", the directory h:boot is not created and surely the file is not copied. If the file h:boot is renamed or deleted, everything goes fine.

Is this expected behaviour or a bug, or I am missing something obvious? Why a file with the same name as the folder which has to be created exists prevents FileCopy from creating that folder and copying the file?

FileCopy("D:\flp.img", "H:\boot\"

This fails the same way.

In addition, is it correct to use a file as destination? Documentation is not 100% clear, and it seems to work.

Using AutoIt



Ahh, never mind, Windows....

Explorer also won't let me create a directory "boot" if a file with the same name already exists in that destination, Windows 7 x64.

Edited by ilko
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...