![]() |
| ||
| Need to delete a file i want to delete a file from a specific location, if file Existing ; using JavaScript or VB scripting |
| ||
| Re: Need to delete a file Javascript, at least broswer embedded Javascript can't do this in a standard compliant way; moving to VB section. |
| ||
| Re: Need to delete a file Well, using VB6 it's really easy: if dir("c:\autoexec.bat", vbnormal) <> vbnullstring then kill "c:\autoexec.bat". However, this becomes a little different in vbscript (and for some reason, a bit uglier).dim filesys |
| ||
| Re: Need to delete a file Hi, use KILL: If Dir("C:\MyText.txt") <> "" ThenRegards Veena |
| ||
| Re: Need to delete a file In VBScript, Kill won't work. I don't think dir() works in VBScript either. If doing this in VB6 (compiled language) it is strongly recommended that you do NOT compare the result of dir with "". if dir("C:\MyText.txt") <> vbnullstring then is a much better method. Double quotes is what is known as a null string. It uses somewhere in the area of around 8 bytes. vbnullstring is a special constant that is built into VB6, that reduces the memory usage to like 1 byte. This isn't a very big deal for small apps with a couple of strings.... but when you get into recursion, or loops with string processing and checking, it will make a visible difference. |
| All times are GMT -4. The time now is 11:18 pm. |
Forum system based on vBulletin Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
©2003 - 2009 DaniWeb® LLC