<font class="small">Code:</font><hr /><pre>
l_strPath = "C:\Temp\" 'File folder
l_strFile = "test*.txt" 'File name
Call fDeleteFile(l_strPath, l_strFile)
Function fDeleteFile(l_strPath, l_strFile)
Set l_objFoundFiles = aqFileSystem.FindFiles(l_strPath, "*" & l_strFile)
If Not l_objFoundFiles Is Nothing Then
Set l_objFile = l_objFoundFiles.Next
Log.Message("File Deleted: " & l_objFile.Path)
Log.Message "No files were found."
Good stuff, but what if you want to use a system variable so it will delete files on Vista, XP, and/or Windows 7? Something like this with %userprofile%(but the followiung does not work because silk does not like the %variable% appearently):
File l_strPath = "%userprofile%\Local Settings\Application Data\directory" 'File folder
In addition to David's answer: you can use the aqEnvironment.GetEnvironmentVariable method to get the value of an environment variable. Please see the "aqEnvironment.GetEnvironmentVariable" help topic for more information.