Jump to content

FileCopy not working


cheeroke
 Share

Recommended Posts

OK, so i run out of ideas how to make this working. Basically my FIleCOpy statement doesn't do it job. I must be missing something. Here is my code:

#RequireAdmin

.
.

Local $fTasks = "C:\Drivers\Other\Tasks\"
Local $fTasksSys = "C:\2\"

.
.
.

FileCopy(GUICtrlRead($fTasks) & "Win10_CNC_Setup", $fTasksSys, 8)
MsgBox(0, "Boot Setting", "Copied Tasks." & $fTasks & "Win10_CNC_Setup" & @CR & "To " & $fTasksSys)
FileDelete($fTasksSys & "ADxLR5_StartUp")
MsgBox(0, "Boot Setting", "Deleted tasks.")

while it is finally creating folder called "2" it does not want to copy files. Files are .xml but without extension one of the is called: "Win10_CNC_Setup".

Another thing is I don't understand why this

$FC_OVERWRITE + $FC_CREATEPATH

doesn't work but if i replace it with this

8

it does create folder.

Main question is - how to make it copying files?

Please help.

Edited by cheeroke
Link to comment
Share on other sites

  • Moderators

What is the value of GUICtrlRead($fTasks)? It is difficult to offer suggestions based off 6 lines of unconnected code...

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Link to comment
Share on other sites

Try this script:

Local $fTasks = "C:\Drivers\Other\Tasks\"
Local $fTasksSys = "C:\2\"

If Not FileExists($fTasksSys) Then DirCreate($fTasksSys)

FileCopy($fTasks & "Win10_CNC_Setup\*.*", $fTasksSys, 8)
MsgBox(0, "Boot Setting", "Copied Tasks." & $fTasks & "Win10_CNC_Setup" & @CR & "To " & $fTasksSys)
FileDelete($fTasksSys & "ADxLR5_StartUp")
MsgBox(0, "Boot Setting", "Deleted tasks.")

Why using GuiCtrlRead? $fTasks is assigned to a string not to a ControlID!

Link to comment
Share on other sites

  • 2 weeks later...

It looks like you are trying to copy an entire folder, why not use dircopy?

 

something like:

Local $fTasks = "C:\Drivers\Other\Tasks\"
Local $fTasksSys = "C:\2\"

If Not FileExists($fTasksSys) Then
    DirCreate($fTasksSys)
EndIf

DirCopy($fTasks, $fTasksSys)
MsgBox(0, "Boot Setting", "Copied Tasks." & @CRLF & "Source: " & $fTasks & "Win10_CNC_Setup" & @CRLF & "To: " & $fTasksSys)
FileDelete($fTasksSys & "ADxLR5_StartUp")
MsgBox(0, "Boot Setting", "Deleted tasks.")

 

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...