Hi Forum,
I’m facing a problem when I loop and try to delete a list of xlsm files in local Desktop PC. Since last Friday some of the files can take up to 3 or 4 minutes to delete. It works fine before though. The file size is maximun 20MB . The RPA code is as below:
Anyone please help
and by the way, the code is developed on Studio Ver: 2018.4.6.
The count of “xlsm” file to delete is around 20 files.
Srini84
(Srinivas Kadamati)
October 26, 2021, 4:24am
3
@caoshixiao1
previously how much time did it take to finish the process?
Thanks
Previously it won’t take more than 1 min
Hi @caoshixiao1
Since you are applying filter after each files it getting slow
Try using the filter condition like below
Directory.GetFiles(“Your filepath”, “*.xlsm”) in assign
and try to delete file item.
Hope this reduce your time consumption!
Regards
@caoshixiao1 , give it a try with the below expression.
Array.ForEach(Directory.GetFiles(DirectoryPath),Sub(x) File.Delete(x))
P.S. Use the above expression in InvokeCode activity
It works fine before, so I dun think its the coding problem. I gona try the Command line to delete the files.
Hi, I would like to delete the files which ends with “.xlsm”, how can I do the code?
caoshixiao1:
“.xlsm”,
Use like this - Array.ForEach(Directory.GetFiles(DirectoryPath,"*xlsm",System.IO.SearchOption.AllDirectories),Sub(x) File.Delete(x))
ManiPrajwal_K:
Array.ForEach(Directory.GetFiles(DirectoryPath,“*xlsm”,System.IO.SearchOption.AllDirectories),Sub(x) File.Delete(x))
Cheers, It works perfectly
1 Like
system
(system)
Closed
October 29, 2021, 5:53am
11
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.