Files not getting deleted from the folder
I have a folder with path " C:\Program Files (x86)\Report2Web Client Tools\Logs".I am trying to delete all the files in it at once.It has twenty files with name as "Burster-2010-02-10.txt" with different dates .I used this in my script as shown below but it does not do any deletion .
if (fs.FileExists(bursterpath + "Logs\\*.txt")) fsDeleteFile(bursterpath + "Logs\\*.txt", true);
(fs.FileExists(bursterpath + "Logs\\*.txt")) DeleteFile(bursterpath + "Logs\\*.txt", );Thanks,Sumedha
RE: Files not getting deleted from the folder
The following sample script works perfectly for me:
I suppose, the problem is actually with the aqFileSystem.FileExists method call as you need to specify full file names without wildcards in the method. If you need to use wildcards, I recommend that you use the aqFileSystem.FindFiles method instead (see the "aqFileSystem.FindFiles" help topic ( http://www.automatedqa.com/support/viewarticle.aspx?aid=3975 ) for more information).
BTW, there is no need to check whether the files exist - you can just call the aqFileSystem.DeleteFile method even if there are no files to delete.
Did my reply answer your question? Give Kudos or Accept it as a Solution to help others. ⬇️⬇️⬇️