Skip to main content

How do I wait until a folder has zero files in it? I see that you can check for file size, folder exists, folder NOT exist but those are not what I need. I want the bot to wait until there are no files in a folder. The folder will always exist. I need to pause bot execution until there are no files in a folder. How can I do that?

Hi @Eddie Pequeno​,

 

There is no inbuild command in AA to verify that no files in a folder. So we have to build our code to make the execution to wait. Please refer the below as it may help you. The bot will wait for 60 seconds if files present in the folder, if no files present, then move out of the loop, so you can do your steps below.

 

Wait for no files in folderRegards,

Karthik R


Hi @Eddie Pequeno​ ,

 

If you are working with A360, could you try the following workflow and see if it works out for you?

 

WaitForFilesToNotExistimage 

image 

Obviously, this solution is not ideal as it will result in an infinite loop if things don't work as expected(files don't get deleted), which means you have to employ some workarounds to impart some intelligence.

 

imageI hope this has at the very least, given you some sort of an idea of what the approach could be for situations like these.

 

Kind Regards,

Ashwin A.K


Thank you so much. karthikr27 and Ashwin A.K. I'll definitely try these solutions. I did find an interesting command called File and Folder Attributes: Files in Folder (Returns a list of all files in a directory). That command seems helpful but I will try these first.

 

Thanks again.


Reply