I am writing a program that should go through a folder with 20 other folders. It should open every folder in which are files, these file names should be copied into a separate excel list. Can you help me with this program?
Hi welcome to the community!
Use Buid Data Table
Create a variable of type String() and assign to this Directory.GetFiles("C:\start","*",SearchOption.AllDirectories)
Create a For Each and iterate that variable
Add rows in the table using item from the loop
Use Write range to create excel
It should open each of this folders:
and just copy the file / folder names in it.
But it also opens the folders inside and get the names of the others files.
you can change the search option to SearchOption.TopDirectoryOnly to get the list of the 20 folders inside and then for each of the folders you can do the same search option to get the files in each of the folders while appending all the file name into the same datatable variable and finally write it into an excel.
Well your issue is simple. The max length of the column is set to 100 in my BuildDataTable.
Increase it to a number that you think is suitable.
Also i have made a modification that gets only the name of the file and not the whole path.
In my sequence i had not added the excel section to write the file.
See this updated one. You can change the file path if you like to the path you desire. Sequence.xaml (10.2 KB)
Once you execute the file will be in the location you have selected.
Now I am working on my second one…
I have a little problem…
My robot should open an excel application and copy each entry and search in different folders for the word, if it finds an entry it should copy the file with the name into a other places.
Can someone help me here out?
The excel file looks like this:
And it should start the search in the first folder:
And if it finds nothing, it should search in the next one.
But if it finds an entry with the name then it should copy it into an onther folder.
I hope someone can help me.
Many thanks in advance!
In your excel sheet what is the name of the column?
I have used LookupDataTable activity which searches for the file name in the datatable(your name excel) based on the column name. If found it will return a positive number else -1.
If you dont have a column name then you can remove the property for that activity.