I have a starting folder C:\Users\JK\Documents\reports PDFs. This contains pdf files e.g. 2223-report.pdf
I have a destination folder W:\Departments\QA\cases containing sub folders, for example W:\Departments\QA\cases\2201 - 2300\2223
I want to move the PDFs from my starting folder to the destination folder but inside subfolders in this destination folder which share part of the file name.
For example 2223-report.pdf would be moved to W:\Departments\QA\cases\2201 - 2300\2223
I read up filemove and tried to tweak the example script for use with subfolders but feeling stuck. How could I tweak my code to move files into subfolders?
Appreciated
JK
-----------
Code: Select all
ErrorCount := MoveFilesAndFolders("C:\Users\JK\Documents\reports PDFs\*.pdf", "W:\Departments\QA\cases")
if (ErrorCount != 0)
MsgBox %ErrorCount% files/folders could not be moved.
MoveFilesAndFolders(SourcePattern, DestinationFolder, DoOverwrite = false)
; Moves all files and folders matching SourcePattern into the folder named DestinationFolder and
; returns the number of files/folders that could not be moved. This function requires [v1.0.38+]
; because it uses FileMoveDir's mode 2.
{
if (DoOverwrite = 1)
DoOverwrite := 2 ; See FileMoveDir for description of mode 2 vs. 1.
; First move all the files (but not the folders):
FileMove, %SourcePattern%, %DestinationFolder%, %DoOverwrite%
ErrorCount := ErrorLevel
return ErrorCount
}