Jump to content

Search the Community

Showing results for tags 'filecopy'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


  • General
    • Announcements and Site News
    • Administration
  • AutoIt v3
    • AutoIt Help and Support
    • AutoIt Technical Discussion
    • AutoIt Example Scripts
  • Scripting and Development
    • Developer General Discussion
    • Language Specific Discussion
  • IT Administration
    • Operating System Deployment
    • Windows Client
    • Windows Server
    • Office


  • AutoIt Team
    • Beta
    • MVP
  • AutoIt
    • Automation
    • Databases and web connections
    • Data compression
    • Encryption and hash
    • Games
    • GUI Additions
    • Hardware
    • Information gathering
    • Internet protocol suite
    • Maths
    • Media
    • PDF
    • Security
    • Social Media and other Website API
    • Windows
  • Scripting and Development
  • IT Administration
    • Operating System Deployment
    • Windows Client
    • Windows Server
    • Office

Find results in...

Find results that contain...

Date Created

  • Start


Last Updated

  • Start


Filter by number of...


  • Start



Member Title




Found 20 results

  1. Hello guys, 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[0] _FileReadToArray($URL[$t], $LINE) For $u = 1 To $LINE[0] FileCopy($URL[$u], $DIR_DEST) Next Next the selected files via OpenFileDialog must be copied to the folder $DIR_DEST.
  2. 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
  3. Struggling to get Filecopy() working MsgBox(0,"Moving file: ", $fLine) ; C:\AlmeterS3\AI74_No2.csv FileCopy( $fLine, "C:\AlmeterS3\S3_Database\") ; FileCopy( $fLine, $BatchDir & "\S3_Database\") If @error Then MsgBox($MB_SYSTEMMODAL, "ERROR!", "database write error " & @error) EndIf FileDelete( $fLine) doesn't copy only creates a file "C:\AlmeterS3\S3_Database" (actually AI74_No2.csv) Again my typo I should have added $FC_OVERWRITE + $FC_CREATEPATH since folder didn't actually exist.
  4. Hi, I do recognize bad behaviour at this snippet: #include <AutoItConstants.au3> Global $g_sSD = @ScriptDir & "\" Global $g_sBurstPath = $g_sSD & "Burst\" DirCreate($g_sBurstPath) Local $sFileName = "Test_mit_3_Seiten.pdf" ; any PDF with more than 1 page inside @ScriptDir FileCopy($g_sSD & $sFileName, $g_sBurstPath & $sFileName, 1) ;~ Sleep(13000) Local $hTimer = TimerInit() ConsoleWrite("Start" & @CRLF) _Burst($g_sBurstPath & $sFileName) ; bursts PDF into single pages ;~ While _FileInUse($g_sBurstPath & $sFileName) ;~ WEnd ConsoleWrite("End: " & Round(TimerDiff($hTimer)) & "ms" & @CRLF) Exit Func _quotePath($sPath) ; because of possible "spaces" inside pathes $sPath = '"' & $sPath & '"' Return $sPath EndFunc Func _Burst($sFile) Local $sPDFtk = $g_sSD & "pdftk.exe" ; path to pdftk.exe (and libiconv2.dll) Local $sCurrWorkingDir = @WorkingDir FileChangeDir($g_sBurstPath) ; it has to change for reasons Local $iPID = Run(_quotePath($sPDFtk) & ' ' & _quotePath($sFile) & ' burst', "", @SW_SHOW, $STDOUT_CHILD + $STDERR_CHILD) ; @SW_SHOW just to see "PDFtk is working" Local $sOutput, $sError While 1 $sOutput &= StdoutRead($iPID) $sError &= StderrRead($iPID) If @error Then ExitLoop Sleep(10) WEnd FileChangeDir($sCurrWorkingDir) ; back to normal EndFunc Func _FileInUse($sFilename) ; by Siao Local $aRet, $hFile $aRet = DllCall("Kernel32.dll", "hwnd", "CreateFile", _ "str", $sFilename, _ ;lpFileName "dword", 0x80000000, _ ;dwDesiredAccess = GENERIC_READ "dword", 0, _ ;dwShareMode = DO NOT SHARE "dword", 0, _ ;lpSecurityAttributes = NULL "dword", 3, _ ;dwCreationDisposition = OPEN_EXISTING "dword", 128, _ ;dwFlagsAndAttributes = FILE_ATTRIBUTE_NORMAL "hwnd", 0) ;hTemplateFile = NULL $hFile = $aRet[0] If $hFile = -1 Then ;INVALID_HANDLE_VALUE = -1 $aRet = DllCall("Kernel32.dll", "int", "GetLastError") SetError($aRet[0]) Return 1 ; file in use (@error contains system error code) Else ;close file handle DllCall("Kernel32.dll", "int", "CloseHandle", "hwnd", $hFile) Return 0 ; file not in use EndIf EndFunc This bursting took about 15000ms. If I activate line 8 "Sleep(13000)" then the bursting itself never needed more than 1000ms. Round about 13000ms delay is needed until bursting is acting very fast, otherwise needing about 15000ms. Then I tested _FileInUse() instead of _Burst() w/o Sleep(13000). This runs in 3ms. It seemes to me that FileCopy() and Burst() are interacting in a way I can't see. Any ideas? Regards, Conrad P.S. You need pdftk.exe and libiconv2.dll at @ScriptDir. This you can get free here: https://www.pdflabs.com/tools/pdftk-server/ (I'm not sure whether I'm allowed to attach it here).
  5. Suppose you want from time to time to update a destination folder with new files that where created at a origin folder. It´s a kind of synchronization, where new files in origin must be "added" to destination. No worry about files that changed, just the new ones. The natural way: FileCopy ($originFolder & "\*.*" , $destinationFolder , $FC_NOOVERWRITE) After many tests, where I have 300 .jpg files in origin and no subfolders: If there is nothing at destination => OK, copy is done. Now destination has 300 files. If I erase at destination 10 files in the middle (explorer, shift del) and then filecopy => the 10 deleted files are NOT copied !! If I erase at destination 10 files "at the beginning"* (explorer, shift del) and then filecopy => the 10 deleted files are copied !! = OK !! * "at beginning" = sorted by name, ascending, erase the 10 first ones. ** I tried $originFolder & "\*.*" , $originFolder&"\" , $originFolder , and many other variants. The same for destination. So, what´s seems to me is that when FileCopy finds the first file from origin that exists at destination it stops to search. That´s expected behavior? Best Regards Jose
  6. 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[0] 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
  7. 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.
  8. $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.
  9. 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! Backup.au3 Edit: DirCopy does pretty much the same
  10. Hello Experts, I am trying to create a script that will go onto my network and copy a word document to a local folder then open it. When I hard code the FileCopy, it works perfectly, but when I use variables for file path and file name, only the local folder I need gets created. I cannot seem to get the file to open even when using the hard coded path in function FileOpen code. Here is my code with comments on what is happening. #include <FileConstants.au3> #include <MsgBoxConstants.au3> #include <WinAPIFiles.au3> $ProductName = "Microsoft Word 2013" $AbvLanguage = "ENG" $Network = "mynetwork" $Folder = "shared" $SampleDocs = "Sample Documents" $DocumentName = "Holiday Schedule.docx" ;Or $FileLocation = "mynetwork\shared\Sample Documents" SampleDocument () Func SampleDocument() ;This commented out hard coded line of code below works and does the copy, create local folder, and paste ;FileCopy ("\\mynetwork\shared\Sample Documents\Microsoft Word 2013\ENG\Holiday Schedule.docx","c:\Sample Documents\",8) ;The opening of FileOpen line of code below has not worked yet, even when the file copy works FileOpen ("C:\Sample Documents\Holiday Schedule.docx") ;Here are the 2 versions of FileCopy code(I only need one, one that works) and 1 version of FileOpen code I want to use with variables that has not work, ever ;FileCopy ("\\$Network\$Folder\$SampleDocs\$ProductName\$AbvLanguage\$DocumentName","c:\Sample Documents\",8) ;FileCopy ("\\$FileLocation\$ProductName\$AbvLanguage\$DocumentName","c:\Sample Documents\",8) ;FileOpen ("c:\$SampleDocs\$DocumentName") EndFunc What am I missing here? Is this as simple as you cannot use variables to create file paths in the FileCopy function?
  11. Hi from Bordeaux, France ! how are you today ? I had a problem with filecopy function. I have a folder with my gifs on a network folder. At the start of my program, i want to make a copy on local pc. Not much complicated. If i do : FileCopy(SOURCE ,DESTINATION, $FC_CREATEPATH)It does'nt work. My destination folder is not empty and contains file which are even present in the source. I would like that filecopy add new file from the source to the destination, without overwrite. But it does'nt work. If i do: FileCopy(SOURCE ,DESTINATION, $FC_OVERWRITE+ $FC_CREATEPATH)This overwrite with all files. So i do that, because it works...but if i only want to copy new file how can i do ? Thanks Nicolas. CopierDossierImage() Func CopierDossierImage() $DossierImagesReseau = "\\sw3308\IntranetSTC\Hors Web\Logiciels STC\Barre STC\images\" $DossierImagesLocal = $DossierBarreSTC & "\Images\" FileCopy($DossierImagesReseau & "*.*", $DossierImagesLocal, $FC_OVERWRITE+ $FC_CREATEPATH) EndFunc ;==>CopierDossierImage
  12. Hello, I have been having an issue with copying files from the current user's application data directory and then copying this in a temporary directory. The confusing thing is that when I look at my log that i had generated it tells me that the copy was successful. I have had previous issues with the FileCopy and DirCopy functions in the past. any ideas why or how I can copy these files successfully. I included a line from my script to give an idea what i'm trying to achieve. I have to retain the current XML file from the user profile and then copy this in to a temp director, then after the install is complete i have to copy this back to the user profile location and overwrite the file. It seems pretty simple..so that's why I'm not understanding what the holdup is here. Any ideas? Thanks. $InstallDir = "C:\Admin\AppUpd\Hyperion Smart View for Office " ;##################################################### ;~Check OS version and file location of properties xml If @OSVersion = "WIN_7" Then FileMove(@AppDataDir & "\Oracle\SmartView\properties.xml", $installDir, $FC_OVERWRITE ) If @OSVersion = "WIN_XP" Then FileMove(@AppDataDir & "\Oracle\SmartView\properties.xml", $installDir, $FC_OVERWRITE ) ;Install The XML file that was copied prior to the install If @OSVersion = "WIN_7" Then FileMove("C:\Admin\AppUpd\Hyperion Smart View for Office\properties.xml", @AppDataDir & "\Oracle\SmartView\properties.xml", $FC_OVERWRITE) If @OSVersion = "WIN_XP" Then FileMove("C:\Admin\AppUpd\Hyperion Smart View for Office\properties.xml", @AppDataDir & "\Oracle\SmartView\properties.xml", $FC_OVERWRITE)
  13. Good Morning, I was hoping to get some help with part of a script I am writing where you have an option to copy a file from a network share to the local C: drive. I have not found the solution, thus asking in the forums for some help, please. I have tried @HomeDrive, which, because I am part of a domain, shows the mapped drive letter not C:. I have tried @SystemDir but that takes me into the Windows folder. I have also tried mapped a drive letter to mycomputernameC$, all with no success. I can copy a file from the network share to a folder on C: but I would like to copy it to just C:. Any help would be greatly appreciated. Thanks, Grimm
  14. Hi guys, Maybe it's a stupid error, but really I can not find a solution. I have a txt with path of files, example: C:\Documents and Settings\Windows Xp\Desktop\autoit-v3-setup.exe C:\Documents and Settings\Windows Xp\Desktop\File.au3 C:\Documents and Settings\Windows Xp\Desktop\RecFileListToArray.au3 C:\Documents and Settings\Windows Xp\Desktop\SciTE4AutoIt3.exe The last line is empty. Now i want to copy the file and i have make this: $Log = FileRead(@WorkingDir & "\Final.txt") $aArray = StringSplit($Log, @LF) For $i = 1 To $aArray[0] -1 ; - 1 remove last empty line ;~ MsgBox(0,0, $aArray[$i]) FileCopy($aArray[$i], "C:\") Next With MsgBox or ConsoleWrite i see the full path, but the FileCopy not work. Some advice? Thanks
  15. 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?
  16. I am having trouble with this simple script. I have a lot of .pdf files that have a generated name. I want to replace them with a number from the document. I can get the number I want to use for the name by opening the .pdf, copying all the text (select all, copy) and converting that to an array. The number I want is always element 35 in that array. Here is my code #include <IE.au3> #include <Excel.au3> #include <Array.au3> #include <Date.au3> #include <File.au3> dim $aLines, $aColumns, $avData[1000][6] = [[0]], $aFile[1000] $FileList = _FileListToArray("Y:\pdf\") WinActivate("Adobe") For $i = 4 to $FileList[0] Sleep(100) Send("^o") WinWaitActive("Open") Sleep(100) Send($FileList[$i]) Sleep(100) Send("{Enter}") Sleep(100) WinWaitActive($FileList[$i]) Send("^a") Sleep(500) Send("^c") Sleep(500) $sPage = Clipget() StringStripCR($sPage) $aFile = StringSplit($sPage, @LF) FileCopy("Y:\pdf\" & $FileList[$i] , "Y:\pdf\new\" & $aFile[35] & ".pdf", 9) Sleep (500) Sleep (500) Send("^w") Sleep(100) Next I don't know why the line "FileCopy("Y:\pdf\" & $FileList[$i] , "Y:\pdf\new\" & $aFile[35] & ".pdf", 9)" does not copy the file. Any help would be appreciated
  17. Hi all, First of all, not sure whether to post this here or example scripts as although it works it does have a problem This is my first script I have made with AutoIT, its very basic but does some deployment tasks to make my life easier. Script: 2 Questions: 1, Why doesn't this part work? If the Computer has a floppy disk, the script still tries to read it even though I have specified no A:\ When it tries to read A:\ the files do not copy from the usb stick & then the script continues to add users to admins. ; Locate USB Drive & assigned drive letter, then copy files. $var = DriveGetDrive( "removable" ) If NOT @error Then For $i = 1 to $var[0] If $var[$i] = "a:" Then ContinueLoop $usbdrive = $var[$i] 2, Can you suggest any improvements to the code, as I've said this is my first one and I've never tried scripting before.
  18. Can someone tell me what is wrong with my syntax here ? RunAs("xxx", "xxxxxx", "xxxxxxx", 0, FileCopy & @LogonServer & "\netlogon\hosts_test c:\windows\system32\drivers\etc")
  19. Hi, I have written a scan utility that scans for certain items on the machine and upload the report to shared path The utility consists of 2 exe files 1) Scanner.exe: Scanner.exe will be running under local admin credentials. This exe does the following functions 1)Scans the machine 2)Write the report in 'C:report.txt' 3)Executes fileuploader.exe with runas function (using credentials which have access to shared path) 2) Fileuploader.exe: Copy 'C:report.txt' to shared path When I execute scanner.exe, the report gets generated, but not getting copied to the shared path. The same happens when I manually do a runas for Fileuploader.exe But when I run Fileuploader by double clicking on Fileuploader.exe, the file is copied to the shared path Attached are the codes for both exe files Any tips would be of great help Thanks in advance Roshith ; ; ; ;Code for Scan $sReport = "Scan is completed" $hFile = FileOpen("C:" & @ComputerName & ".txt", 2) FileWriteLine($hFile, $sReport) FileClose($hFile) FileInstall(".FileUploader.exe", @TempDir & "FileUploader.exe", 1) RunAs("username", "domain", "password", 0, @TempDir & "FileUploader.exe", @SystemDir, @SW_HIDE) FileCopy("C:" & @ComputerName & ".txt", "ServerDir1Dir2", 1)
  20. I got this code which copies some files in my network to pcs with open office. Really useful if you got lots of pc's. How would I "display" a message that the file was copied successfully ? A bit lost since I use a case here. I know i could call the filecopy in a variable but since I verify if the os is windows 7, xp or 2k thats where I get lost a bit. like this but its not enough since i don't have my os verification going on : $variable = FileCopy ( $CompletePath & "mission" & $NextMis & ".mis", $CompletePath & "currentmis.mis",1 ) If $variable = 1 then ;Do something Else ;Do something else Endif This is my current code Local $os = @OSVersion If Not IsDeclared("iMsgBoxAnswer") Then Local $iMsgBoxAnswer $iMsgBoxAnswer = MsgBox(4, "Vérification de la version de OpenOffice", "Est-ce que la version 3.3 ou supérieur de openOffice est installé ?") Select Case $iMsgBoxAnswer = 6 ;Yes If $os = "WIN_7" Then FileCopy("", @AppDataDir & "OpenOffice.org3user", 1) Else If $os = "WIN_XP" Then FileCopy("", @AppDataDir & "OpenOffice.org3user", 1) Else If $os = "WIN_2000" Then MsgBox(1, "OpenOffice 3.3", "Ne pas installer ou utiliser Openoffice sur Windows 2000") EndIf EndIf EndIf Case $iMsgBoxAnswer = 7 ;No Exit EndSelect
  • Create New...