I have a file "tmp.txt" in a format like word0, c:\1.txt word2, c:\2.txt word4, c:\Copy of tmp1.txt I need to delete all the files listed in 2nd column. I tried this script. Const ForReading = 1 Set objFSO = CreateObject("Scripting.FileSystemObject") Set objTextFile = objFSO.OpenTextFile("c:\tmp.txt", ForReading) Do Until objTextFile.AtEndOfStream strNextLine = objTextFile.Readline arrServiceList = Split(strNextLine , ",") Wscript.Echo "File Name to be deleted : " & arrServiceList(1) strFilePath = "arrServiceList(1)" set objFSO = CreateObject("Scripting.FileSystemObject") objFSO.DeleteFile(strFilePath) Loop It gives me Error on line "objFSO.DeleteFile(strFilePath)" File Not found. This is my first script. Please help Kuldeep
Thanks to Bishop I found the solution. http://groups.google.co.in/group/microsoft.public.scripting.vbscript/browse_thread/thread/1014fb5ce4294acf?hl=en# Kuldeep On Jul 3, 12:04 pm, Kuldeep wrote: > I have a file "tmp.txt" in a format like > > word0, c:\1.txt > word2, c:\2.txt > word4, c:\Copy of tmp1.txt > > I need to delete all the files listed in 2nd column. > > I tried this script. > > Const ForReading = 1 > Set objFSO = CreateObject("Scripting.FileSystemObject") > Set objTextFile = objFSO.OpenTextFile("c:\tmp.txt", ForReading) > Do Until objTextFile.AtEndOfStream > strNextLine = objTextFile.Readline > arrServiceList = Split(strNextLine , ",") > Wscript.Echo "File Name to be deleted : " & arrServiceList(1) > strFilePath = "arrServiceList(1)" > set objFSO = CreateObject("Scripting.FileSystemObject") > objFSO.DeleteFile(strFilePath) > Loop > > It gives me Error on line "objFSO.DeleteFile(strFilePath)" > > File Not found. > > This is my first script. > Please help > > Kuldeep