I’m new to VBscript and would like some help on moving a specific number of files from one directory to another.
Right now I currently have a set of 3 files(for testing purposes) with different extensions and would like to move all of the files if there are exactly 3 files(no more and no less) inside the source directory. My code so far is:
Set fso=CreateObject("Scripting.FileSystemObject")
Set fldr=fso.getFolder("C:\folderA")
for each file in fldr.files
If fldr.files < 3 then
msgbox("Need more files")
Else
fso.MoveFile "C:\folderA\*", "C:\folderB"
End If
Any help would be greatly appreciated.
Thanks, everyone!
fso.getFolder("C:\folderA").Files.Countto get the number offiles in
C:\folderA.