How to get the count of files from folder

how to get the count of files from folder

Hi @dhanashree22

Use the function below!

Directory.GetFiles(“Yourpath”).Count
will give Count of file present in folder!

Regards

1 Like

unrecognized escape sequence are coming why sir

Hi @dhanashree22

Can you share me your Screenshot of your workflow!

Regards

Hi

Use a assign activity like this

int_count = Directory.GetFiles(“yourfolderpath”).Count

Where int_count is a variable of type int32 defined in variable panel

Cheers @dhanashree22

1 Like

Hi @dhanashree22 ,

Create a variable with type array of string which stores the files from that particular folder
Array_Files = Directory.GetFiles(“Path”)

Array_Files.Count gives you count like how many files are present in the Folder.

Same like, Directory.GetDirectories(Variablename).Count gives you count like how many folders are present in that directory.

Thanks,
Ashwin

Doc1.docx (130.4 KB)

here what should do next
if i agin take the assign
count=directory.getfiles(path).count
it gives error here .count<> is coming like this
i want count().

It looks fine
Make sure no variable is of type int32

Are facing any error while running the bot
@dhanashree22

Doc1.docx (143.5 KB)

Doc1.docx (143.5 KB)
please give solution

Hi

Make sure that Countfile is of type int32 and mention like this in right side of the assign activity

System.IO.Directory.GetFiles(“yourfolderpath”).Count

Cheers @dhanashree22

yes i have mention correctly.but still its gave error.

ensure that there is no copy paste issue from the quotes you will need: " instead of