FileWatcher .vbs Script to move files to a new folder

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

Moderators: DataMystic Support, Moderators

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

FileWatcher .vbs Script to move files to a new folder

Post by DataMystic Support » Wed Jun 16, 2010 6:33 am

This script could also be written using a .BATch file, but here it is as a .VBS script.

Save as move_to_folder.vbs

Code: Select all

'FileWatcher script - move files to a new folder

Option Explicit

dim objArgs
dim fso
dim filename
dim folder

Set fso = CreateObject("Scripting.FileSystemObject")

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


for each filename in objArgs

	If fso.FileExists( filename ) Then
		fso.MoveFile filename, "c:\destfolder\"
	End If

next

Set fso = Nothing
Set objArgs = Nothing
Command: C:\Windows\System32\wscript.exe
Parameters: <full path\>move_to_folder.vbs %FILE%
Attachments
move files.zip
(373 Bytes) Downloaded 706 times
Regards,

Simon Carter, http://DataMystic.com/forums/index.php
http://PredictBGL.com - Insulin dose calculator for Type 1 diabetes
http://DownloadPipe.com - 250,000 free software downloads
http://DetachPipe.com - send huge email attachments

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

Re: FileWatcher .vbs Script to move files to a new folder

Post by DataMystic Support » Mon Jul 16, 2018 7:57 pm

Easy! The file system object (fso) has a method to create a new folder called CreateFolder().

So just use

fso.createFolder( "newname" )

with whatever the new name needs to be
Regards,

Simon Carter, http://DataMystic.com/forums/index.php
http://PredictBGL.com - Insulin dose calculator for Type 1 diabetes
http://DownloadPipe.com - 250,000 free software downloads
http://DetachPipe.com - send huge email attachments

Post Reply