Hi,

I am wondering if anybody can help me with vbscript code for the
following operations:

The script should read all the file names from a folder one by one
(lets say the folder name is c:\test).
For each file name read a process has to occur (I have the script for
the process I need).
After reading the file the file needs to be moved to an "OLD" folder
(c:\test\old).
Then move to the next file.... etc.

Thank you,

Carly

Re: reading file names, processing them, renaming them by Steven

Steven
Wed Mar 15 13:39:16 CST 2006

'// DoSomething.vbs
Option Explicit
Call FileProc(".\")
WScript.Echo "Done"
Sub FileProc(sStart)
Dim objFSO, objFldr, objSFldr, objFile, sTempFilename. sNewPath
'// New folder path
sNewPath = "c:\test\old"
'// Follow-on
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFldr = objFSO.GetFolder(sStart)
'// Process files
For Each objFile In objFldr.Files
'// Put filename into temp var
sTempFilename = objFile.Name
'// Code for whatever it is you are wanting
'// to do should be placed here

'// Move the file
objFSO.MoveFile objFile.Path, sNewPath & "\" & objFile.Name
Next
'// Uncomment next 3 lines for recursion
'//For Each objSFldr In objFldr.SubFolders
'// Call FileProc(objSFldr)
'//Next
End Sub
'// End DoSomething.vbs

--
Regards

Steven Burn
Ur I.T. Mate Group
www.it-mate.co.uk

Keeping it FREE!

"Carly" <carl.jung@hotmail.com> wrote in message
news:1142449825.635212.303900@e56g2000cwe.googlegroups.com...
> Hi,
>
> I am wondering if anybody can help me with vbscript code for the
> following operations:
>
> The script should read all the file names from a folder one by one
> (lets say the folder name is c:\test).
> For each file name read a process has to occur (I have the script for
> the process I need).
> After reading the file the file needs to be moved to an "OLD" folder
> (c:\test\old).
> Then move to the next file.... etc.
>
> Thank you,
>
> Carly
>