Forum Discussion
AlexeyKolosov
15 years agoStaff
Hi Sumedha,
The following sample script works perfectly for me:
aqFileSystem.DeleteFile("c:\\1234\\*.txt");
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.