FileWatcher: Ignore Files e.g. '.partial'

Discuss our other products here. Get help with installation and running, notify us of bugs, request new features and enhancements.

Moderators: DataMystic Support, Moderators, DataMystic Support, Moderators, DataMystic Support, Moderators

Post Reply
User avatar
DataMystic Support
Site Admin
Posts: 2227
Joined: Mon Jun 30, 2003 12:32 pm
Location: Melbourne, Australia
Contact:

FileWatcher: Ignore Files e.g. '.partial'

Post by DataMystic Support »

Ignore files based on a regular expression.

Save as rename_files.vbs

Code: Select all

'FileWatcher script - Ignore files based on a regular expression.

Option Explicit

dim objArgs
dim fso
dim filename
dim folder

dim myRegExp
set myRegExp = New RegExp
myRegExp.IgnoreCase = False   'no need
myRegExp.Pattern = "\.partial$"               'match everything ending in .partial


Set fso = CreateObject("Scripting.FileSystemObject")

'Set a reference to the arguments
Set objArgs = Wscript.Arguments


for each filename in objArgs

	If not( myRegExp.Execute( filename ) ) Then
		fso.MoveFile filename, "c:\destfolder\"
	End If

next

Set fso = Nothing
Set objArgs = Nothing
Set myRegExp = Nothing
Command: C:\Windows\System32\wscript.exe
Parameters: <full path\>rename_files.vbs %FILE%
Post Reply