the_oliver Posted January 21, 2007 Share Posted January 21, 2007 (edited) Hello,I need some help with a .vbs script please (very basic script, not visual basic).I need to find a way that a script can read through a text file, line by line, and submit it to a function as a variable.... Some thing along the line of: For 'every line individualy' Do 'this'.My second problem is that i need to be able to copy a folder, including its subdirectorys to another place. How could i go about this.Thanks for any help you can give! Im a bit of a novice as you can tell!Thanks! Edited January 21, 2007 by the_oliver Link to comment Share on other sites More sharing options...
Yzöwl Posted January 21, 2007 Share Posted January 21, 2007 Hope these help!example 1strInFile = "C:\Temp\temp.txt"Set objFSO = CreateObject("Scripting.FileSystemObject")Set objFile = objFSO.OpenTextFile(strInFile, 1)Do Until objFile.AtEndOfStream strChrs = objFile.ReadLine wscript.echo strChrsLoopexample 2strSPath = "C:\SomePath\SourceDir"strDPath = "C:\SomePath\DestDir"Set objFSO = CreateObject("Scripting.FileSystemObject")Sub CopyTree(srcPath, dstPath) Dim objSubFolders, objSubFolder On Error Resume Next Set objSubFolders = objFSO.GetFolder(srcPath).SubFolders For Each objSubFolder in objSubFolders objFSO.CreateFolder dstPath & "\" & objSubFolder.Name CopyTree srcPath & "\" & objSubFolder.Name, dstPath & "\" & objSubFolder.Name NextEnd SubCopyTree strSPath, strDPath Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now