Jump to content

Filecopy won't overwrite or create folder


Recommended Posts

 

I thought this would be simple. This script will copy the files, as long as the dest folder already exist. If the dest folder doesn't exist, then it just creates a file with the content of the 1st log in it. Also, it won't overwrite files.

I've tried variations...

Any help would be appreciated.

FileCopy("c:\users\ckuser\documents\pixelwix pixelwarp evo\logs\*.*", "c:\ck\system_info\pw_logs\", $FC_OVERWRITE + $FC_CREATEPATH) FileCopy("c:\users\ckuser\documents\pixelwix pixelwarp evo\logs\*.*", "c:\ck\system_info\pw_logs\", '$FC_OVERWRITE + $FC_CREATEPATH' )
FileCopy("c:\users\ckuser\documents\pixelwix pixelwarp evo\logs\*.*", "c:\ck\system_info\pw_logs\", "$FC_OVERWRITE + $FC_CREATEPATH" )

Thanks...

Link to comment
Share on other sites

Link to comment
Share on other sites

The argument 9 as Neutro posted should work.

However its important to understand WHY.

Did you view the help page for the command?

https://www.autoitscript.com/autoit3/docs/functions/FileCopy.htm

And generally when sharing its best to show the variable instead of the magic number.

FileCopy("c:\users\ckuser\documents\pixelwix pixelwarp evo\logs\*", "c:\ck\system_info\pw_logs\", $FC_OVERWRITE + $FC_CREATEPATH)

If you do not have it working, I would check permissions.

Perhaps elevate your script and run it as admin. 

The largest glaring issue I see, and what is probably your problem is you have your arguments encapsulated in quotes, they should not be, as then your not resolving the variable and instead just telling autoit that its a string.

Edited by ViciousXUSMC
Link to comment
Share on other sites

The reason for Neutro's 9 at the end of the script is because the two flags have been added together (1+8 = 9).

See helpfile for the flags:

$FC_OVERWRITE (1) = overwrite existing files
$FC_CREATEPATH (8) = Create destination directory structure if it doesn't exist (See Remarks).

 

You can also just use the following to copy all files into the folder:
 

FileCopy("c:\users\ckuser\documents\pixelwix pixelwarp evo\logs\", "c:\ck\system_info\pw_logs\", 9)

 

 

Kind Regards
Skeletor

"Coffee: my defense against going postal."

Microsoft Office Splash Screen | Basic Notepad Program (Beginner) | Transparent Splash Screen | Full Screen UI

Link to comment
Share on other sites

  • 4 weeks later...

I don't think there is a difference to the machine. I've had good luck using the BitXOR function and then listing all parameters within, especially when opening special types of forms with specific control boxes.

Who lied and told you life would EVER be fair?

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

  • Recently Browsing   0 members

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