With my thanks to sister_annex for their help
, the following script now works like a dream, I have published it here to aid others if they need similar script.....
Code:
Set myFSO = CreateObject("Scripting.FileSystemObject")
filelocation = "c:\vbcopy\paths.txt" 'Enter the location of your txt file here
If myFSO.FileExists(filelocation) Then 'this checks if the file exists
Set logfile = myFSO.OpenTextFile(filelocation, 1) 'opens the text file for reading only
Do While Not logfile.AtEndOfStream 'initiates a loop and loops until the end of the file
strcontents = ""
strcontents = logfile.ReadLine 'reads a line into the variable
If Not strcontents = "" then 'checks the line is not empty
'DO YOUR WORK HERE
Set fso = CreateObject("Scripting.FileSystemObject")
Set FSO =CreateObject("scripting.FileSystemObject")
fso.copyfolder "C:\vbcopy\Student Data files", strcontents&"\", true
End if
Loop
logfile.Close 'closes the file
end if