Jump to content
cheeroke

FileCopy not working

Recommended Posts

cheeroke

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

Share this post


Link to post
Share on other sites
JLogan3o13

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


√-1 2^3 ∑ π, and it was delicious!

Share this post


Link to post
Share on other sites
AutoBert

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!

Share this post


Link to post
Share on other sites
Wingens

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

 

Share this post


Link to post
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

  • Similar Content

    • Reziskonh
      By Reziskonh
      Hi, everybody
      I look for GUI whose behavior similar to the message of an email client or antivirus
      In other words:
          Any PC screen able to calculate the size
          To consider the Task bar size
          To find the lower corner on the right/below and to nestle on it

      Notes:
      In GUI the GUICtrlCreateEdit field (as option) - that can be received and displayed through variable information
      Thanks a lot
      PS
      I use the translator, excuse if something is not clear
       

    • VollachR
      By VollachR
      Hi,
      I'd like to show a progress bar for an operation performed by an external program my script is running silently, I want to show it in a GUI I created using the GUICtrlCreateProgress but I have no idea how to do it.
      The important thing to point out is that there's no way of knowing how long the external program will run, as it is a file splitter and it depends on the size of file it splits and the split parts size.
      Can someone point me in the right direction or give me an example how to do so?
      This is my RunWait command:
      RunWait($MYFILES1 & '\fsplit.exe -split ' & $Size & ' mb ' & $File & " -f " & $File & "." & $extension) It uses multiple variables declared and set earlier in the script, how will I got about having the progress of that command shown using GUICtrlCreateProgress ? Is it possible?
      Thank you.
    • Tats
      By Tats
      Hi,
      Good Day!
      I have a problem and having difficulty implementing it. I want to copy the files in a certain folder, rename it, and when it exist in the destination folder it will add an index counter.
       
      Example source folder having files like:
      AA_123.TXT
      BB_123.TXT
      CC_123.TXT
      DD_123.TXT
       
      After file copy the target folder would be like this:
      123.TXT
      123_1.TXT
      123_2.TXT
      123_3.TXT
       
      How to achieve this?
      Thanks in advance
       
       
    • nacerbaaziz
      By nacerbaaziz
      Hello my friends
      I have an inquiry and I hope to find the answer here
      I want to create a graphical user interface
      but I want to hide the system menu
      I mean the window menu
      Is this possible?
      If is possible please give me how to do that
      Thanks in advance
    • helmar
      By helmar
      I was playing around with simple GUI creation.  I tend to like parameter driven coding (in prior life (years ago) as Clipper/FoxPro/dBase coder).  Just wanted to see what I could do with a GUI.
      #Region options, includes Opt('MustDeclareVars', 1) Opt("GUIOnEventMode", 1) ; Change to OnEvent mode #include <GUIConstantsEx.au3> #EndRegion options, includes Global Const $nCols = 2, $nRows = 6, $nSpacer = 10, $nBtnWidth = 150, $nBtnHeight = 30 Global $xName = 0, $xID = 0 Global $nGUIWidth = ($nCols * $nBtnWidth) + (($nCols + 1) * $nSpacer) Global $nGUIHeight = ($nRows * $nBtnHeight) + (($nRows + 1) * $nSpacer) Global $hMainGUI = GUICreate("Calculated GUI", $nGUIWidth, $nGUIHeight, -1, -1) For $xRows = 1 to $nRows ;in this arrangement, tabbing is left to right, then next row For $xCols = 1 to $nCols ;reverse the order of this line with the prior line for top to bottom tabbing, then next col $xName += 1 $xID += 1 Global $Dummy = GUICtrlCreateButton("Button" & $xName, _ ($nBtnWidth * ($xCols - 1)) + (($xCols - 1) * $nSpacer) + $nSpacer, _ ($nBtnHeight* ($xRows - 1)) + (($xRows - 1) * $nSpacer) + $nSpacer, _ $nBtnWidth, _ $nBtnHeight) GUICtrlSetOnEvent($xID+2, "Handler") Next Next GUISetOnEvent($GUI_EVENT_CLOSE, "CloseApp") GUISetState(@SW_SHOW) While 1 Sleep(10) WEnd Func CloseApp() Exit EndFunc Func Handler() MsgBox(0,0,"Button " & @GUI_CtrlId - 2) EndFunc  
×