Jump to content

FileCopy function is creating blank 0 byte files


Recommended Posts

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?

Link to comment
Share on other sites

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
Spoiler

“Hello, ladies, look at your man, now back to me, now back at your man, now back to me. Sadly, he isn’t me, but if he stopped using ladies scented body wash and switched to Old Spice, he could smell like he’s me. Look down, back up, where are you? You’re on a boat with the man your man could smell like. What’s in your hand, back at me. I have it, it’s an oyster with two tickets to that thing you love. Look again, the tickets are now diamonds. Anything is possible when your man smells like Old Spice and not a lady. I’m on a horse.”

 

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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
Spoiler

“Hello, ladies, look at your man, now back to me, now back at your man, now back to me. Sadly, he isn’t me, but if he stopped using ladies scented body wash and switched to Old Spice, he could smell like he’s me. Look down, back up, where are you? You’re on a boat with the man your man could smell like. What’s in your hand, back at me. I have it, it’s an oyster with two tickets to that thing you love. Look again, the tickets are now diamonds. Anything is possible when your man smells like Old Spice and not a lady. I’m on a horse.”

 

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
 Share

×
×
  • Create New...