6 posts in this topic
I have a script which is copying one file (the latest file among a bunch of structured folders) from one network device to another network device.
The weird thing is the file copied successfully to the destination folder right after the FileCopy command ran but the script is hanging for another few minutes until it return with exit code 0.
Below is my script:
#include <MsgBoxConstants.au3> #include <File.au3> #include <Array.au3> #include <FileConstants.au3> copyfile() Func copyfile() Local $testLogFile = FileOpen(@ScriptDir & "\CopyMSI", 1) Local $BuildArtifacts = "\\vm-build\BuildArtifacts" Local $dServer = "\\VM-DEV\c$\Users\Administrator\Desktop" Send("#r") WinWaitActive("Run") ControlSend("Run", "", 1001, $BuildArtifacts) ControlClick("Run", "OK", 1) _FileWriteLog($testLogFile, "Opened Builds folder") ;trying to get the latest build folder and grab the latest msi file for copying WinWaitActive("BuildArtifacts") Local $FolderList = _FileListToArray($BuildArtifacts, "Grand-4.*") _ArraySort($FolderList, 1) Local $latestSEbuild = $FolderList Sleep (5000) WinClose("BuildArtifacts") Local $sServer = $BuildArtifacts & '\' & $latestSEbuild & '\G4.msi' ; start copying file from build to destination folder FileCopy($sServer, $dServer, $FC_OVERWRITE) _FileWriteLog($testLogFile, "Copied MSI") EndFunc
I'm working on this script:
Case $BTN Global $URL = FileOpenDialog("IMPORT FILE", $DESKTOP, "ALL FORMAT (*)", 4) $DIR_DEST = "C:\DIR-WORK\list\IMPORT_DOC\" DirCreate($DIR_DEST) Local $LINE For $t = 1 To $URL _FileReadToArray($URL[$t], $LINE) For $u = 1 To $LINE FileCopy($URL[$u], $DIR_DEST) Next Next the selected files via OpenFileDialog must be copied to the folder $DIR_DEST.
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?
$RootDir = "C:\x86\" $BinariesFolder = "C:\Binaries\x86\0717-15.Binary.r9642_Release_win32_Fresh" $DestinationFolder = $RootDir & "_AppFiles-Telos" $SourceFolder=$BinariesFolder FileCopy($SourceFolder & "\*.*", $DestinationFolder & "\", $FC_OVERWRITE + $FC_CREATEPATH) In the above code, even if I keep $FC_OVERWRITE, the existing files are not getting replaced.
Any suggestion please.
I'm writing a small program for creating a backup. I want to do that by using FileCopy. Everything from drive C should be copied to drive D.
FileCopy("C:", "D:", $FC_OVERWRITE + $FC_CREATEPATH) That doesn't do anything, though. I played a bit with the paths, but nothing does what I want. Sometimes only the folder of the program itself is copied, sometimes nothing is copied.
What am I doing wrong? What do I have to do that everything from C goes to D? Thanks!
Edit: DirCopy does pretty much the same