cancel
Showing results for 
Search instead for 
Did you mean: 

How to know whether a folder is empty - Get Files question

YingjieZhu
Level 2

Hello, I'm trying to copy a file to a destination folder.
Before copying, I need to check whether the folder is empty,
if it's not empty, I need to trigger a email with filenames found in the folder, and
if it is empty, just copy.

I tried to use action Get Files, and follow by a Decision stage using the Successful Flag generated by the VBO.

The problem is no matter there is or is not file in the folder, the 'Success Flag' is always TRUE, so it always go to email sending stage?
Besides, how can I get the file names (normally 1 or 2 files only) from the Collection and include them in the email?



------------------------------
Regards,
Yingjie
------------------------------

2 REPLIES 2

HarshitRawat
Level 8

Hello,

Below is a sample flow which can serve your purpose

31233.png

First you would use the same Get Files action on the folder;

The File details ( if any file is present ) would be in the output collection of Get Files

If there are any files present the rows in the collection would be greater than 0 and the process can get file names and send email

31234.png

31235.png

31236.png

To extract the file names you can use a loop and keep on appending the values of Files collection.Name in a data item and append that data item in the email

31237.png

let me know if you face any issue 



------------------------------
Harshit Rawat
------------------------------

vinodchinthakin
Level 9
Hi Yingjie

You can use this VBO https://digitalexchange.blueprism.com/dx/entry/113833/solution/atcs---utility-file-management which helps to get files/folder count


------------------------------
vinod chinthakindi
------------------------------