DougInCanada
Technical User
Hello All,
Here's the deal...
I have a text file with a list of folder names.
ie:
C:\folder1
C:\folder2
C:\folder3
I would like to reference each folder in the textfile, line by line, insert the folder name into the GetFolder(FolderNameHere), allowing me to perform an action with each line in a loop...
My script is generating a syntax error (Line xx Char 1) when I try to complete the following:
dim strDouble, strString, FSO, objdirectory, TheFiles
Set FSO = CreateObject("Scripting.FileSystemObject")
strDouble = Chr(34)
Set txtNames = FSO.OpenTextFile("C:\FolderNames.txt", 1)
Do Until txtNames.AtEndOfStream
The Script dies on the next line...
[COLOR=red yellow]Set objDirectory = FSO.GetFolder(strDouble & txtNames.readline & strDouble)[/color]
The rest of the code hasn't tested out yet, but this is the idea...
Set TheFiles = objDirectory.Files
....
Loop
It seems like I've tried everything to get FSO.GetFolder to read the FolderPath from a string variable, but it only seems to read an actual string, like the Set txtNames line above. I've even tried using another string, strFolderName, create this variable:
strFolderName = strDouble & txtNames.Readline & strDouble
then insert just the string strFolderName in place of the required Path string, but that doesn't work either...
Is this normal? Should I be using another method?
This is a show stopper for me....help?
Here's the deal...
I have a text file with a list of folder names.
ie:
C:\folder1
C:\folder2
C:\folder3
I would like to reference each folder in the textfile, line by line, insert the folder name into the GetFolder(FolderNameHere), allowing me to perform an action with each line in a loop...
My script is generating a syntax error (Line xx Char 1) when I try to complete the following:
dim strDouble, strString, FSO, objdirectory, TheFiles
Set FSO = CreateObject("Scripting.FileSystemObject")
strDouble = Chr(34)
Set txtNames = FSO.OpenTextFile("C:\FolderNames.txt", 1)
Do Until txtNames.AtEndOfStream
The Script dies on the next line...
[COLOR=red yellow]Set objDirectory = FSO.GetFolder(strDouble & txtNames.readline & strDouble)[/color]
The rest of the code hasn't tested out yet, but this is the idea...
Set TheFiles = objDirectory.Files
....
Loop
It seems like I've tried everything to get FSO.GetFolder to read the FolderPath from a string variable, but it only seems to read an actual string, like the Set txtNames line above. I've even tried using another string, strFolderName, create this variable:
strFolderName = strDouble & txtNames.Readline & strDouble
then insert just the string strFolderName in place of the required Path string, but that doesn't work either...
Is this normal? Should I be using another method?
This is a show stopper for me....help?