Forum Discussion
i am unable to delete file from the folder getting An error occurred while deleting the file(folder) used
aqFileSystem.DeleteFile(file true);
- rraghvani2 years agoChampion Level 3
Is the file opened or in use?
- RK32 years agoOccasional Contributor
no File is not open or in use i can delete manually
but with testcomplete giving the error
- KB12 years agoChampion Level 2
.
- rraghvani2 years agoChampion Level 3
Can you post your code please? I would like to see the fully qualified path name of the file you are trying to delete, and a screenshot of the exact error message
- RK32 years agoOccasional Contributor
function delete(){
var folderPath="E:\\testing"
var filename ="deletefile.txt"
var file= folderPath+"\\"+filename+".txt"
if(aqFileSystem.Exists(file))
{
aqFileSystem.DeleteFile(file,true)
}
- rraghvani2 years agoChampion Level 3
You can't used the function name delete() as it's a reserved word in TC.
Also, filename is equal to "deletefile.txt", and you are appending ".txt" to file. So you are deleting file E:\testing\deletefile.txt.txt?
- RK32 years agoOccasional Contributor
yes
function delete12()
{var folderPath="E:\\testing"
var filename ="deletefile"
var file= folderPath+"\\"+filename+".txt"
if(aqFileSystem.Exists(file))
{
aqFileSystem.DeleteFile(file,true)
}
} - RK32 years agoOccasional Contributor
even this code also giving same error
function ABC(FieldNames,FieldValues){
try{
const parameterList = dictonary(FieldNames,FieldValues);
const folderPath = parameterList["FolderPath"];
var filename = parameterList["FileName"];
var file =folderPath+"\\"+filename+".txt"
if(aqFileSystem.Exists(file))
{
aqFileSystem.DeleteFile(file,true)
}
}
catch(error)
{
Log.Error(error.message):
return false;
}
}
- rraghvani2 years agoChampion Level 3
What is aqFileSystem.DeleteFile(file,true), true used for?
Since the declaration only accepts one parameter
Can you just run this,
aqFileSystem.DeleteFile("E:\\testing\\deletefile.txt")
Does this work?
- RK32 years agoOccasional Contributor
i am getting access is denied for the file to be deleted . when i explore i saw some one is added extra parameter (true) to the code . I have tried it on the file method
- RK32 years agoOccasional Contributor
even removing the true parameter will be the same
Related Content
- 2 years ago
Recent Discussions
- 6 days ago
- 6 days ago
- 9 days ago