How to view specific folders in a directory

Hey, guys.

I’ve an issue…

Please help me, I have a shared folder containing files and 16 folders, I only need to check 12 folders from the shared folder. Inside these 12 folders are PDF files and WORD files (for example, file names in word and pdf in this format - “NumberCompany_NameCompany.docx” and “NumberCompany_NameCompany.pdf”).
Next, if I find WORD files in one of the folders, I only load these WORD files into the system, after booting into the system, I will transfer these WORD files and PDF to another folder - “Uploaded to the system”

image

Best Regards

Hi @Serik_Tashenov

You can use directory.getdirectories(you shared folder path) it will return an array of all sub folders ,use for each and put an if condition inside loop to check if the directory name is Match with your required folder name.

If it matches you can use another for each with directory.getfiles(value coming from for above for each) which returns an array with file names inside the folder where you can use move file or copy file activity to move the files to a new locy.

2 Likes

thank you!

please show how it will look like, tried it in different ways, until it works


best regards

Will send a sample workflow in some time so it is easier to understand…thanks

1 Like

thank you very much!! I was told through REFramework to do this process. I was also told the links to each folder from a common folder, in the folder of the project “Input” create an Excel file and then write links to folders to write, and then through the queues move

Hi @Serik_Tashenov

I have attached the sample workflow.sample.xaml (8.8 KB)

Actually, he is asking need to check all the folder files and if he finds the word files he needs to move that to a system like this right?

Hi @copy_writes

Not all the folders only the month folders i guess

So inside that particular folder he need to extract the word type(.docx) and pdf type files right?

I think he need to read all the folder like 1,2,3,4,5,…12 he want to go through all the folder and check the pdf and docx :slightly_smiling_face:

yes all the month folders and also inside the month folders all the docx and pdf files.

1 Like

Then what you give its right read main folder and in side for each need to check subfolder use for each and put condition use if (contains folder =“Word.doxc” or “*.pdf”) and use move files activty to another folder

if you dont mind can you please explain this code what you write

Directory.GetFiles(item.ToString, “.”, SearchOption.AllDirectories).Where(Function(s) s.EndsWith(“.docx”) Or s.EndsWith(“.pdf”))

The item.ToString contains the month folder path, directory.getfiles method is used to get all the file path in a specific folder into an array, and then we use linq query to filter only the filenames that ending with either docx format or pdf format.

1 Like

what is this code

I guess, It will search for the directories inside the month folder also, if month folder has sub folders it will search in that folder also.

1 Like

I need to read all folders (01,02,03,04,05,06,07,08,09,10,11,12) that may contain word and pdf files.
Then I just need word files to upload to the program. After loading word files into the program, I need to move, for example, all word files, including pdf files, from the directory 04 to the folder “Uploaded to the system”


Best Regards

I was told to do it through REFramework, into the Excel file add all paths to each of the folders, and then process each transaction. Now I’m thinking about how to do this. Now I’ve been able to add 12 transactions to the queue with paths to each folder. Now I’m thinking about what to do next

Best Regards

Hi @Serik_Tashenov these may not require RE frame work as it is a simple process, i would advice to do in a flow chart or sequence. you can refer the workflow i have uploaded earlier in the conversation

Thanks

1 Like