Hey im back and stuck in a sticky spot. I have this script I have been working on and currently it is supposed to do the following:
Input box to put computer name in
Then check to see if "\\%computername%\c$\documents and settings\%user account name% or folderobject.name\local settings\temp" exist
Everything looks like it is working right untill you get down to the if statment. it should be doing. If it exist then echo the path if it does not then echo that it does not but what i keep running into is the ones that do exist echo back but when it reaches one that does not it just errors out. I tested it with on error resume next and it will work great,
... rootfolder = ("\\" & servicetag & "\C$\Documents and Settings\" & folderobject.name & "\Local Settings\temp\") If FSO.FolderExists(rootfolder) Then Set objFolder = FSO.GetFolder(rootfolder) Set colFiles = objFolder.Files WScript.Echo objFolder.Path Else MsgBox rootfolder & " Folder Does not Exist" End if
Hey that worked great and i thank you for your help but I have anohter one now. What I gave you was basicly the beggining of the code and im adding onto it. Heres what I have so far:
So now what I got it doing is the same as above but now its is writing to a log file. I have commented out the part where it echos objectfolder.path... i dont need that any more so now I have it set to echo the files in objectfolder.path (...\temp) then to call a sub that echos the subfolders and there files and loops back into itself basically forcing it to list all files and folders sub of temp. But when I run it i get duplicate paths. Here is the output file i get.
\\c0jmyd1\c$\Documents and Settings\Administrator\Local Settings\Temp\libFNP_events.log \\c0jmyd1\c$\Documents and Settings\Administrator\Local Settings\Temp\Acrobat Distiller 8 \\c0jmyd1\c$\Documents and Settings\Administrator\Local Settings\Temp\Acrobat Distiller 8\test.txt \\c0jmyd1\c$\Documents and Settings\Administrator\Local Settings\Temp\avgdiag \\c0jmyd1\c$\Documents and Settings\Administrator\Local Settings\Temp\tosBtExt \\c0jmyd1\c$\Documents and Settings\Administrator\Local Settings\Temp\~DF29B7.tmp \\c0jmyd1\c$\Documents and Settings\Administrator\Local Settings\Temp\Acrobat Distiller 8 \\c0jmyd1\c$\Documents and Settings\Administrator\Local Settings\Temp\Acrobat Distiller 8\test.txt \\c0jmyd1\c$\Documents and Settings\Administrator\Local Settings\Temp\avgdiag \\c0jmyd1\c$\Documents and Settings\Administrator\Local Settings\Temp\tosBtExt \\c0jmyd1\c$\Documents and Settings\Administrator\Local Settings\Temp\~DFDFA0.tmp \\c0jmyd1\c$\Documents and Settings\Administrator\Local Settings\Temp\Acrobat Distiller 8 \\c0jmyd1\c$\Documents and Settings\Administrator\Local Settings\Temp\Acrobat Distiller 8\test.txt \\c0jmyd1\c$\Documents and Settings\Administrator\Local Settings\Temp\avgdiag \\c0jmyd1\c$\Documents and Settings\Administrator\Local Settings\Temp\tosBtExt
dont mind my computer name but notice it didnt read A - Z it read that libFNP_events.log file then started A - Z and repeats a lot of them.
That worked great as well and I thank you, you have been very helpful to me with this script and now it looks like it is up and running the way it is supposed to be with the exception of one little bug. I dont know if I have explained to you what it is yet but its is going to be a PC cleaning script that will clean C:\windows\temp, C:\documents and settings\%username%\local settings\temp and C:\documents and settings\%username%\local settings\tempary internet files. but instead of just doing it on your machine you can do it on a remote machine.
I know this makes me look really bad but I want to know iif you have any ideas on the bug I looked everywhere and I can not seem to find anything. I noticed the script will not write the path to the file if the path is to long thus the file does not get deleted. Also it will not delete a folder if it contains a file thats name is to long.