Jump to content

Search the Community

Showing results for tags 'XCOPY'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • 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

Categories

  • 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

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Member Title


Location


WWW


Interests

Found 4 results

  1. Hi Guys/Gals, if in your job, like me you have to lots shunt files around on regular basis and use xcopy to do this, then this may come in useful for you. I originally wrote version 1 years ago, but decided that it deserved some more of my time, so here it is version 2 and here's the code #cs ---------------------------------------------------------------------------- AutoIt Version: 3.3.6.1 Author: Richard Easton#include <ButtonConstants.au3> Script Function: XCopy GUI Version 2 Feature: Hidden Cmd window with in gui CMD Progress. More checkbox functions #ce ---------------------------------------------------------------------------- ; Script Start - Add your code below here #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <GuiListView.au3> #include <GUIListBox.au3> #include <ListViewConstants.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #include <Date.au3> $Xcopy_GUI = GUICreate("XCopy GUI Version2", 834, 600, -1, -1) ;target information $Target_Information = GUICtrlCreateGroup(" Target Information ", 8, 16, 817, 73) GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif") GUICtrlCreateLabel("Source", 16, 40, 38, 17) $SourceInput = GUICtrlCreateInput("", 80, 37, 577, 21) GUICtrlSetColor(-1, 0xF0F0F0) GUICtrlSetBkColor(-1, 0x008080) $Sourcebtn = GUICtrlCreateButton("Browse to Source", 664, 36, 153, 23) GUICtrlCreateLabel("Destination", 16, 64, 57, 17) $DestInput = GUICtrlCreateInput("", 80, 60, 577, 21) GUICtrlSetBkColor(-1, 0x1B80E4) $Destbtn = GUICtrlCreateButton("Browse to Destination", 664, 60, 153, 21) GUICtrlSetState($Destbtn, $GUI_DISABLE) GUICtrlCreateGroup("", -99, -99, 1, 1) ;xcopy options $Xcopy_Options = GUICtrlCreateGroup(" XCopy Options ", 8, 96, 817, 137) GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif") $Option_subdirs = GUICtrlCreateCheckbox("Copy directories and subdirectories, including empty ones.", 16, 112, 400, 17) GUICtrlSetState(-1, $GUI_CHECKED) $option_assumedir = GUICtrlCreateCheckbox("If Destination does not exist, assume that it is a directory.", 16, 131, 400, 17) GUICtrlSetState(-1, $GUI_CHECKED) $option_overwrite = GUICtrlCreateCheckbox("Suppress prompting to confirm overwrite. (will overwrite if checked)", 16, 151, 400, 17) $option_errorcontinue = GUICtrlCreateCheckbox("Continue even if an error occurs.", 16, 172, 400, 17) GUICtrlSetState(-1, $GUI_CHECKED) $option_verify = GUICtrlCreateCheckbox("Verifies the size of each new file.", 16, 191, 400, 17) $option_noname = GUICtrlCreateCheckbox("Does not display file names while copying.", 16, 210, 400, 17) $option_encryptedfiles = GUICtrlCreateCheckbox("Copies encrypted files to destination, that does not support it.", 424, 210, 400, 17) $option_copyhands = GUICtrlCreateCheckbox("Copies hidden and system files.", 424, 191, 400, 17) $option_copyarchoff = GUICtrlCreateCheckbox("Only copies files with the archive bit set, turning it off after.", 424, 112, 400, 17) $option_copyarchon = GUICtrlCreateCheckbox("Only copies files with the archive bit set, leaving it on after.", 424, 131, 400, 17) $option_restartablemode = GUICtrlCreateCheckbox("Copies networked files in restartable mode.", 424, 151, 400, 17) If @OSVersion = "WIN_XP" Then $option_unbuffered = GUICtrlCreateCheckbox("Copies using unbuffered I/O. Recommended for very large files.", 424, 172, 400, 17) GUICtrlSetState(-1, $GUI_UNCHECKED) GUICtrlSetState(-1, $GUI_DISABLE) Else $option_unbuffered = GUICtrlCreateCheckbox("Copies using unbuffered I/O. Recommended for very large files.", 424, 172, 400, 17) GUICtrlSetState(-1, $GUI_CHECKED) EndIf GUICtrlCreateGroup("", -99, -99, 1, 1) ;progress pain $Session_Progress = GUICtrlCreateGroup(" Session Progress ", 8, 240, 817, 321) GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif") $Progress = GUICtrlCreateListView("", 16, 256, 801, 292, -1, $LVS_EX_GRIDLINES) GUICtrlCreateGroup("", -99, -99, 1, 1) ;controls $copy = GUICtrlCreateButton("Proceed with copy", 677, 568, 147, 25) GUICtrlSetState($copy, $GUI_DISABLE) _GUICtrlListView_AddColumn($Progress, "Description", 580, 0) _GUICtrlListView_AddColumn($Progress, "Date/Time", 200, 0) GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Sourcebtn $source = FileSelectFolder("Select Source Folder", "", 1 + 2 + 4) If @error Then ;check to see if no folder has been selected MsgBox(48, "Source Folder", "no folder selected or dialogue cancelled", 5) Else ;update source input If $source = "computer" Then MsgBox(48, "Warning!", "Invalid Location selected", 5) Else GUICtrlSetData($SourceInput, $source, "") $tCur = _Date_Time_GetSystemTime() GUICtrlCreateListViewItem("Source Location Selected, checking size|" & _Date_Time_SystemTimeToDateTimeStr($tCur), $Progress) Sleep(500) $sourcesize = DirGetSize(GUICtrlRead($SourceInput), 1) If Round($sourcesize[0] / 1024 / 1024) < 1000 Then $tCur = _Date_Time_GetSystemTime() GUICtrlCreateListViewItem("Source directory size(Mb): " & Round($sourcesize[0] / 1024 / 1024) & "|" & _Date_Time_SystemTimeToDateTimeStr($tCur), $Progress) Else $tCur = _Date_Time_GetSystemTime() GUICtrlCreateListViewItem("Source directory size(Gb): " & Round($sourcesize[0] / 1024 / 1024 / 1024, 2) & "|" & _Date_Time_SystemTimeToDateTimeStr($tCur), $Progress) EndIf GUICtrlSetState($Destbtn, $GUI_ENABLE) EndIf EndIf Case $Destbtn $destination = FileSelectFolder("Select Destination Folder", "", 1 + 2 + 4) ;read source location $source = GUICtrlRead($SourceInput) If @error Then ;check to see if no folder has been selected MsgBox(48, "Destination Folder", "no folder selected or dialogue cancelled", 5) ElseIf $source > "" Then ;check source and destination are the same, if they are display warning! If $destination = $source Then MsgBox(48, "Warning!", "Source and Destination cannot be the same!", 5) Else If $destination = "computer" Then MsgBox(48, "Warning!", "Invalid Location selected", 5) Else;update destination input GUICtrlSetData($DestInput, $destination, "") $tCur = _Date_Time_GetSystemTime() GUICtrlCreateListViewItem("Destination Location Selected, checking freespace|" & _Date_Time_SystemTimeToDateTimeStr($tCur), $Progress) If StringLen(GUICtrlRead($DestInput)) > 3 Then $destloc = StringLeft(GUICtrlRead($DestInput), 3) $destfreespace = DirGetSize($destloc, 1) Else $destfreespace = DirGetSize(GUICtrlRead($DestInput), 1) EndIf ;check for Mb or Gb If Round($destfreespace[0] / 1024 / 1024) < 1000 Then ;Check source is not bigger than destination If Round($destfreespace[0] / 1024 / 1024) < Round($sourcesize[0] / 1024 / 1024) Then MsgBox(48, "XCopy GUI", "There is not enough freespace on the destination to copy all data" & @CR & "Please choose another destination") $tCur = _Date_Time_GetSystemTime() GUICtrlCreateListViewItem("Not enough freeSpace on Destination|" & _Date_Time_SystemTimeToDateTimeStr($tCur), $Progress) GUICtrlSetData($DestInput, "", "") Else $tCur = _Date_Time_GetSystemTime() GUICtrlCreateListViewItem("Destination FreeSpace(Mb): " & Round($destfreespace[0] / 1024 / 1024) & "|" & _Date_Time_SystemTimeToDateTimeStr($tCur), $Progress) GUICtrlCreateListViewItem("Sufficient freespace to do copy|" & _Date_Time_SystemTimeToDateTimeStr($tCur), $Progress) GUICtrlSetState($copy, $GUI_ENABLE) EndIf Else If Round($destfreespace[0] / 1024 / 1024 / 1024, 2) < Round($sourcesize[0] / 1024 / 1024 / 1024, 2) Then MsgBox(48, "XCopy GUI", "There is not enough freespace on the destination to copy all data" & @CR & "Please choose another destination") $tCur = _Date_Time_GetSystemTime() GUICtrlCreateListViewItem("Not enough freeSpace on Destination|" & _Date_Time_SystemTimeToDateTimeStr($tCur), $Progress) GUICtrlSetData($DestInput, "", "") Else $tCur = _Date_Time_GetSystemTime() GUICtrlCreateListViewItem("Destination FreeSpace(Gb): " & Round($destfreespace[0] / 1024 / 1024 / 1024, 2) & "|" & _Date_Time_SystemTimeToDateTimeStr($tCur), $Progress) GUICtrlCreateListViewItem("Sufficient freespace to do copy|" & _Date_Time_SystemTimeToDateTimeStr($tCur), $Progress) GUICtrlSetState($copy, $GUI_ENABLE) EndIf EndIf EndIf EndIf EndIf Case $copy ; cmd line for xcopy is ProgressOn("XCopy GUI", "Please Wait", "Checking options", -1, -1) ProgressSet(10, "Checking Options", "Please Wait") Sleep(2000) $subdirs = GUICtrlRead($Option_subdirs) $assumedirs = GUICtrlRead($option_assumedir) $overwrite = GUICtrlRead($option_overwrite) $errorcontinue = GUICtrlRead($option_errorcontinue) $verify = GUICtrlRead($option_verify) $noname = GUICtrlRead($option_noname) $encfiles = GUICtrlRead($option_encryptedfiles) $copyhands = GUICtrlRead($option_copyhands) $archoff = GUICtrlRead($option_copyarchoff) $archon = GUICtrlRead($option_copyarchon) $restartable = GUICtrlRead($option_restartablemode) $unbuffered = GUICtrlRead($option_unbuffered) ; 'XCOPY source destination /E /I /Y /C /V /Q /G /H /A /M /Z /J' If $subdirs = 1 Then $subdirs = "/E " Else $subdirs = "" EndIf If $assumedirs = 1 Then $assumedirs = "/I " Else $assumedirs = "" EndIf If $overwrite = 1 Then $overwrite = "/Y " Else $overwrite = "" EndIf If $errorcontinue = 1 Then $errorcontinue = "/C " Else $errorcontinue = "" EndIf If $verify = 1 Then $verify = "/V " Else $verify = "" EndIf If $noname = 1 Then $noname = "/Q " Else $noname = "" EndIf If $encfiles = 1 Then $encfiles = "/G " Else $encfiles = "" EndIf If $copyhands = 1 Then $copyhands = "/H " Else $copyhands = "" EndIf If $archoff = 1 Then $archoff = "/A " If $archon = 1 Then GUICtrlSetState($option_copyarchon, $GUI_UNCHECKED) EndIf Else $archoff = "" EndIf If $archon = 1 And $archoff = 4 Then $archon = "/M " Else $archon = "" EndIf If $restartable = 1 Then $restartable = "/Z " Else $restartable = "" EndIf If $unbuffered = 1 Then $unbuffered = "/J" Else $unbuffered = "" EndIf ProgressSet(30, "Options Set", "Please Wait") Sleep(2000) ProgressSet(40, "Checking Locations", "Please Wait") $source = GUICtrlRead($SourceInput) $destination = GUICtrlRead($DestInput) If $source = "" Or $destination = "" Then MsgBox(48, "Warning!", "There is a problem with one location", 5) Sleep(2000) ProgressOff() Else Sleep(2000) ProgressSet(50, "Source and Destination verified", "Please Wait") Sleep(2000) EndIf ProgressSet(80, "Preparing Command", "Please Wait") $cmdprep = 'Xcopy "' & $source & '" "' & $destination & '" ' & $subdirs & $assumedirs & $overwrite & $errorcontinue & $verify & $noname & $encfiles & $copyhands & $archoff & $archon & $restartable & $unbuffered ProgressSet(100, "Ready to go :D", "Checks Complete") Sleep(2000) ProgressOff() $tCur = _Date_Time_GetSystemTime() GUICtrlCreateListViewItem("Xcopy from '" & $source & "' to '" & $destination & "' Started|" & _Date_Time_SystemTimeToDateTimeStr($tCur), $Progress) ;subdirs,assumedir,overwrite,errorcontinue,verify,noname,encryptedfiles,copyhands,copyarchoff,copyarchon,restartablemode,unbuffered ;disable the options GUICtrlSetState($Option_subdirs, $GUI_DISABLE) GUICtrlSetState($option_assumedir, $GUI_DISABLE) GUICtrlSetState($option_overwrite, $GUI_DISABLE) GUICtrlSetState($option_errorcontinue, $GUI_DISABLE) GUICtrlSetState($option_verify, $GUI_DISABLE) GUICtrlSetState($option_noname, $GUI_DISABLE) GUICtrlSetState($option_encryptedfiles, $GUI_DISABLE) GUICtrlSetState($option_copyhands, $GUI_DISABLE) GUICtrlSetState($option_copyarchoff, $GUI_DISABLE) GUICtrlSetState($option_copyarchon, $GUI_DISABLE) GUICtrlSetState($option_restartablemode, $GUI_DISABLE) GUICtrlSetState($option_unbuffered, $GUI_DISABLE) GUICtrlSetState($Sourcebtn, $GUI_DISABLE) GUICtrlSetState($Destbtn, $GUI_DISABLE) GUICtrlSetState($copy, $GUI_DISABLE) ;run the cmd RunWait(@ComSpec & " /c " & $cmdprep, "", @SW_SHOW) ;completed message $sourcesize = DirGetSize(GUICtrlRead($SourceInput), 1) $destsize = DirGetSize(GUICtrlRead($DestInput), 1) ;check sizes match If $destsize[0] = $sourcesize[0] Then MsgBox(64, "Xcopy Gui", "'" & $source & "' Copied to '" & $destination & "' Successfully.", 3) $tCur = _Date_Time_GetSystemTime() GUICtrlCreateListViewItem("Xcopy from '" & $source & "' to '" & $destination & "' Completed|" & _Date_Time_SystemTimeToDateTimeStr($tCur), $Progress) Else MsgBox(64, "Xcopy Gui", "'" & $source & "' Copied to '" & $destination & "' , but final sizes do not match.", 3) $tCur = _Date_Time_GetSystemTime() GUICtrlCreateListViewItem("Xcopy from '" & $source & "' to '" & $destination & "' Completed, but sizes do not match|" & _Date_Time_SystemTimeToDateTimeStr($tCur), $Progress) EndIf ;re-enable the options GUICtrlSetState($Option_subdirs, $GUI_ENABLE) GUICtrlSetState($option_assumedir, $GUI_ENABLE) GUICtrlSetState($option_overwrite, $GUI_ENABLE) GUICtrlSetState($option_errorcontinue, $GUI_ENABLE) GUICtrlSetState($option_verify, $GUI_ENABLE) GUICtrlSetState($option_noname, $GUI_ENABLE) GUICtrlSetState($option_encryptedfiles, $GUI_ENABLE) GUICtrlSetState($option_copyhands, $GUI_ENABLE) GUICtrlSetState($option_copyarchoff, $GUI_ENABLE) GUICtrlSetState($option_copyarchon, $GUI_ENABLE) GUICtrlSetState($option_restartablemode, $GUI_ENABLE) If @OSVersion <> "WIN_XP" Then GUICtrlSetState($option_unbuffered, $GUI_ENABLE) EndIf GUICtrlSetState($Sourcebtn, $GUI_ENABLE) GUICtrlSetState($Destbtn, $GUI_ENABLE) GUICtrlSetState($copy, $GUI_ENABLE) EndSwitch WEnd I've compiled it in 32bit and 64bit version contained in this rar Feedback would be nice
  2. Hello Everyone, Please pardon my noobiness. I am working on backup restore script where a progress bar is required. I have tried using following code which works fine with folders but not really with single file because robocopy Func CopyFolder($srcDir, $destDir, $part) ;======> $part shows whats being copied (e.g. Desktop, Documents etc.) If StringRight($srcDir, 1) = "\" Then $srcDir = StringLeft($srcDir, StringLen($srcDir) - 1) If Not FileExists($destDir) Then DirCreate($destDir) $srcSize = DirGetSize($srcDir, $DIR_EXTENDED) $1_percent = $srcSize[0] / 100 $cmd = 'C:\Windows\System32\robocopy.exe "' & $srcDir & '" "' & $destDir & '" /E /Z /XO /XX /FFT /XJ /NDL /NJH /FP /ETA /NP /V /R:10 /W:5 /LOG+:"' & $logFile & '" /XF desktop.ini thumbs.db' Run(@ComSpec & " /c " & $cmd, "", @SW_HIDE) Do Sleep(300) Until ProcessExists("robocopy.exe") ProgressOn($part, $1_percent & "%", "", 0, 0, 16) Do $destSize = DirGetSize($destDir, $DIR_EXTENDED) ProgressSet(Round($destSize[0] / $1_percent, 2), Round($destSize[0] / (1024 * 1024), 2) & " MB of " & Round($srcSize[0] / (1024 * 1024), 2) & " MB copied", Round($destSize[0] / $1_percent, 2) & "%") Sleep(200) Until ProcessExists("robocopy.exe") = 0 ProgressOff() FileWriteLine($logFile, @CRLF & @CRLF) EndFunc ;==>CopyFolder Part of the problem is that I need to generate logs of files being copied. One particular problem is firefox profile directory. the directory is named as oi3jdslk.default or asdwdx.new and I need to copy places.sqlite from this directory. Xcopy manages to copy FROM this directory but not TO this directory because of wildcards Then I came across this neat script Func CopyFile($fromFile, $todirectory) Local $FOF_RESPOND_YES = 16 Local $FOF_SIMPLEPROGRESS = 256 $winShell = ObjCreate("shell.application") $winShell.namespace($todirectory).CopyHere($fromFile, $FOF_RESPOND_YES) EndFunc ;==>CopyFile It helped me copy other single files but not the one required from firefox profile folder. Here is how I am trying to process that $path = @UserProfileDir & "\AppData\Roaming\Mozilla\Firefox\" & $ffDir & "\places.sqlite" CopyFile($path, $BUFolder & "Mozilla") ;===> $BUFolder = "E:\" & @username & " - Backup\" #cs ====================================================== $ffDir is another variable derived from this function. This variable is the gets the default firefox profile to copy places.sqlite from $ffDir is returned as Profiles\xbsen2s.default (Firefox randomizes the profile directory for extra security(?). At least that's what they say. #ce ====================================================== Func FFProfile() Local $iniFile = @UserProfileDir & "\AppData\Roaming\Mozilla\Firefox\profiles.ini" Local $ddNumber Local $ddLine Local $Line If FileExists($iniFile) Then FileOpen($iniFile, 0) For $i = 1 To _FileCountLines($iniFile) $Line = FileReadLine($iniFile, $i) If StringInStr("DEFAULT=1", $Line) Then $ddNumber = $i - 1 ExitLoop ElseIf StringInStr("Name=default", $Line) Then $ddNumber = $i + 2 EndIf Next $ddLine = FileReadLine($iniFile, $ddNumber) $ffDir = StringReplace(StringTrimLeft($ddLine, 5), "/", "\") $ffInstall = 1 Else $ffInstall = 0 EndIf FileClose($iniFile) EndFunc ;==>FFProfile I really like how natural the progress bar from second copy script look like and would like to keep the progress bar uniform across the program. I am willing to learn if anyone can point me in right direction and help me achieve this. Any help is highly appreciated!!
  3. Hello, I just wrote a script that should copy data into my cloud using xcopy (cmd), but I want the Status Bar I have in my GUI to change it's text like that: working. -> working.. -> working... -> working. ... I would also like to make a button which interrupts xcopy (simply closing it should do the trick), but I don't know how to call ProcessClose("xcopy.exe") using a button, while I'am waiting for RunWait to finish. Example: $command = 'xcopy "' & @DesktopDir & '\text.txt"' & ' "\\ADMIN-CLOUD\private\" /EECHIY' $SW_STATE = @SW_HIDE RunWait(@ComSpec & " /c " & '"' & $command & '"', @DesktopDir, $SW_State) Please tell me if you need any further information!
  4. From within an AutoIt Script, I'm trying to use psexec with system authority to copy files from one place on a remote machine to another. When I issue the necessary command outside of the script (at a command prompt), the command executes properly. Here's the exact one-line command: psexec \\vmhartlti01 -s XCOPY "C:\temp\hs\Hyperspace POC.lnk" "C:\Documents and Settings\All Users\Application Data\Landesk\ManagementSuite\Launchpad\Dept Apps\" /Y When I try to run the exact same command from within an AutoIt Script, an XCOPY parse error 4 flashes up for a millisecond in the console and the command fails. The command appears to be formed properly in the message box popup. $cmd = 'psexec \\vmhartlti01 -s XCOPY "C:\temp\hs\Hyperspace POC.lnk" "C:\Documents and Settings\All Users\Application Data\Landesk\ManagementSuite\Launchpad\Dept Apps\" /Y' MsgBox(4096, "test", $cmd) $XCopyStatus = Run($cmd, "c:\temp") The Run command returns the XCOPY PID rather than zero, further obfuscating the problem. I've been working on this for a while now and I think I must be missing something. Does anyone see the problem? Thanks for your help.
×
×
  • Create New...