I have a script that is supposed to rename any .pgp file extension to .bak and move files to a backup folder.
When I execute the script it looks like it selects more than just the .pgp extension (like .txt and .vbs). Any ideas?
'Rename .pgp files after ftp upload
Dim filesys, file, folderName, objFile, folderObj, fileColl, objRegExp, newFile
Set filesys = CreateObject("Scripting.FileSystemObject")
folderName = "c:\myfolder\myfiles\"
Set folderObj = filesys.GetFolder(folderName)
Set fileColl = folderObj.Files
Set objRegExp = New RegExp
objRegExp.Pattern = ".pgp" 'looking for .pgp (extension) match
objRegExp.IgnoreCase = True
For Each objFile In fileColl
newFile = objRegExp.Replace(objFile.Name, ".bak") 'replacing with .bak extension
filesys.MoveFile objFile, folderName & "backup\" & newFile
Next
When I execute the script it looks like it selects more than just the .pgp extension (like .txt and .vbs). Any ideas?
'Rename .pgp files after ftp upload
Dim filesys, file, folderName, objFile, folderObj, fileColl, objRegExp, newFile
Set filesys = CreateObject("Scripting.FileSystemObject")
folderName = "c:\myfolder\myfiles\"
Set folderObj = filesys.GetFolder(folderName)
Set fileColl = folderObj.Files
Set objRegExp = New RegExp
objRegExp.Pattern = ".pgp" 'looking for .pgp (extension) match
objRegExp.IgnoreCase = True
For Each objFile In fileColl
newFile = objRegExp.Replace(objFile.Name, ".bak") 'replacing with .bak extension
filesys.MoveFile objFile, folderName & "backup\" & newFile
Next