Get the total count of files

Hello!

I want to get the total count of file’s which is available in folder’s so how can i get that?
i got the each files count from folder’s,Know i want the total count from all the folder’s files.

Hi @Priyesh_Shetty1
Try this

I hope it helps!!

@Priyesh_Shetty1
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

1 Like

@lrtetala I want the total count of the files from all the folder’s

@lrtetala I got the each count of the files from folder’s but know i want total of all the files.

@Priyesh_Shetty1
I think all sub folders are in one main folder
then give Main Folder name in for each

@lrtetala yes have created one folder inside that there are different different folder’s inside that folder’s there are files

@lrtetala I have given the path of that main folder only but it is giving the output of each folder’s count.

@Priyesh_Shetty1
Try this

Hi,

How about the following expression?

System.IO.Directory.GetFiles("yourFolderPath","*.*",searchOption.AllDirectories).Length

Regards,

Hi @Priyesh_Shetty1

As per your requirement I have attached the workflow of the process below and the steps.

  1. Use an “Assign” activity and create an Variable totalCount and initialize with 0.
totalCount=0
  1. Use assign acitivty and give your main folder Path variable say folderPath.
folderPath= "your folder path"
  1. Add a “For Each” activity and write the below condition:
Directory.GetDirectories(folderPath)
  1. Use “Assign” activity and give below condition:
 totalCount= totalCount + Directory.GetFiles(folderPath).Length
  1. After the loop, you can use the totalCount variable as needed in writeline or message Box.
    Folder Retrieve.zip (177.3 KB)

Hope it helps!!
Regards,

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.