FileExist() did not work

 I have this fuction, to check if the .pac extension in the folder, do copy all the *.pac file from a location to another. after copied then delete in source folder.

But it seems it didnot work because of the FileExist method, objFSO.FileExists(source & "*.pac") where i trying to put condition on all. Can someone please tell me what should i change? If can i still wanna do checking first before the copying.

If I used MoveFile method, can it do overwrite, if file have same name?

thanks? 

 

Dim newfolderDim dest dest = "C:\Destination\"Dim source source = "C:\Archive\"Dim objShell: Set objShell = CreateObject("Shell.Application")Dim objFSO: Set objFSO = CreateObject("Scripting.FileSystemObject")'create folder if not existIf Not objFSO.FolderExists(dest) Thennewfolder = objFSO.CreateFolder (dest,true)WScript.Echo "A new folder '" & newfolder & "' has been created" End IfIf objFSO.FileExists(source & "*.pac") ThenDim objFolder: Set objFolder = objFSO.GetFile(source & "*.pac")Const OverwriteExisting = TrueobjFSO.CopyFile source & "*.pac" , dest , OverwriteExistingWScript.Echo "File copying...."oAutoIt.Sleep(300)objFSO.DeleteFile(source & "*.pac")WScript.Echo "File deleting...."Else Wscript.Echo "File does not exist."End IfWScript.Quit

I don’t think the filesystem object supports wildcards in the FileExists method. I have to question why you are using Automise to do so much scripting. Looking at your script it seems to me that everything it’s doing could be done by Automise Actions.