Skip to content

Instantly share code, notes, and snippets.

@jasp402
Last active March 5, 2019 19:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jasp402/709b01ddafdbdd1c8b93170e5935c120 to your computer and use it in GitHub Desktop.
Save jasp402/709b01ddafdbdd1c8b93170e5935c120 to your computer and use it in GitHub Desktop.
AutoIt: Search recursively for files and copy
#include <Array.au3>
#include <File.au3>
#include <MsgBoxConstants.au3>
Global $data = 'ZZZZZ00B40.PDF|ZZZZZ00B46.PDF|ZZZZZ00BE5.PDF|ZZZZZ00BEA.PDF|ZZZZZ00BGE.PDF|ZZZZZ00BQO.PDF|ZZZZZ00C5C.PDF|ZZZZZ00HIG.PDF|ZZZZZ00S47.PDF|ZZZZZ00S48.PDF|ZZZZZ00STJ.PDF|ZZZZZ00T4V.PDF|ZZZZZ00VGT.PDF|ZZZZZ00VGU.PDF|ZZZZZ00X8F.PDF|ZZZZZ00KB2.PDF|ZZZZZ00KDM.PDF|ZZZZZ00MLV.PDF|ZZZZZ00U1W.PDF|ZZZZZ00UEF.PDF|ZZZZZ00VDC.PDF|ZZZZZ00VDV.PDF|ZZZZZ00NYT.PDF|ZZZZZ00PS1.PDF|ZZZZZ00R6W.PDF|ZZZZZ00NZ7.PDF|ZZZZZ00NZ8.PDF|ZZZZZ00NZ9.PDF|ZZZZZ00O5T.PDF|ZZZZZ00QZS.PDF|ZZZZZ00QZT.PDF|ZZZZZ00T0X.PDF|ZZZZZ00TNG.PDF|ZZZZZ00TTF.PDF|ZZZZZ00TZV.PDF|ZZZZZ00VYP.PDF|ZZZZZ00WOH.PDF|ZZZZZ00X9Q.PDF|ZZZZZ00X9R.PDF|ZZZZZ010N0.PDF|ZZZZZ01710.PDF|ZZZZZ01711.PDF|ZZZZZ01766.PDF|ZZZZZ0179G.PDF|ZZZZZ01783.PDF|ZZZZZ017HY.PDF|ZZZZZ01AUN.PDF|ZZZZZ017JB.PDF|ZZZZZ0181X.PDF|ZZZZZ0190A.PDF|ZZZZZ019XX.PDF|ZZZZZ01B1V.PDF|ZZZZZ01CM7.PDF|ZZZZZ01EYG.PDF|ZZZZZ01EYH.PDF|ZZZZZ01HRI.PDF|ZZZZZ01F0V.PDF|ZZZZZ01F0W.PDF|ZZZZZ01F9T.PDF|ZZZZZ01FFD.PDF|ZZZZZ01FZ0.PDF|ZZZZZ01HS7.PDF|ZZZZZ01J6D.PDF|ZZZZZ01QON.PDF'
Global $hFilePath = 'Y:\BACKUP'
Local $LoopData = StringSplit($data, '|')
For $i = 1 to $LoopData[0] - 1
$aArray = _FileListToArrayRec($hFilePath, $LoopData[$i], $FLTAR_FILES, $FLTAR_RECUR, $FLTAR_SORT)
If @error Then
MsgBox($MB_SYSTEMMODAL, "Ooops!", "files Not found")
Else
FileCopy($hFilePath&'\'&$aArray[1], 'Y:\FOUND\', $FC_OVERWRITE + $FC_CREATEPATH)
ConsoleWrite($hFilePath&'\'&$aArray[1]& " | File found and copy!"&@CRLF)
EndIf
Next
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment