Jump to content

Recommended Posts

Posted

Hi,

I am experiencing a strange issue with the FileCopy function. When I use FileCopy with the overwrite existing files flag, it creates a blank 0 byte file with the same name as the folder the file would reside if if the folder existed.

For example:

FileCopy("\\Server\share\acaddoc.lsp", "C:\Program Files\Autodesk\AutoCAD MEP 2011\", 1)

This will create a blank 0 byte file named "AutoCad MEP 2011" on computers where that path does not already exist. I thought if the path does not exist, the function ends. Am I missing something?

Posted (edited)

  On 6/19/2012 at 3:09 PM, 'kgreer said:

Hi,

I am experiencing a strange issue with the FileCopy function. When I use FileCopy with the overwrite existing files flag, it creates a blank 0 byte file with the same name as the folder the file would reside if if the folder existed.

For example:

FileCopy("Servershareacaddoc.lsp", "C:Program FilesAutodeskAutoCAD MEP 2011", 1)

This will create a blank 0 byte file named "AutoCad MEP 2011" on computers where that path does not already exist. I thought if the path does not exist, the function ends. Am I missing something?

FileCopy("Servershareacaddoc.lsp", "C:Program FilesAutodeskAutoCAD MEP 2011*", 1)
Edited by mechaflash213
  Reveal hidden contents

 

Posted

WOW! That works. Should I make it a best practice to always include the asterisk at the end of every FileCopy function?

The issue only seems to occur if the destination directory path exists up until the last folder. If that makes sense.

Posted (edited)

I do. It's just good practice, especially if/when you ever have to skim over code, seeing an asterisk at the end of a path lets you know you're dealing with files and not folders in cases of simple functions such as FileMove(), FileCopy() etc.

Edited by mechaflash213
  Reveal hidden contents

 

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
×
×
  • Create New...