How can i Extract the entire folder hierarchy

How can i Extract the entire folder hierarchy and files names inside and put it into a excel file ??

Hi @Soudios ,
You can use
Path.GetFileName(folder.ToString)
to get all sub folder
Path.GetFileName(file.ToString)
to get all file
my code
list_file_and_folder.xaml (18.6 KB)
my output
test.xlsx (8.4 KB)

you can edit location write with your requirement
if write in one column is easier
regards,
LNV

@Soudios

arr_folders=directory.getdirectory(“Mainfolderpath”)

Gives you the entire folders in the main folder

inside use

For each activity inside

use

assign activity

path.getfilename(currentitem).tostring Gives you the each filename inside all the folders

this is what i need, i don’t need path juste the folder and file name

image

refer to:

Directory.GetFiles(MyDirPathVar,"*.*",SearchOption.AllDirectories)
New DirectoryInfo(MyDirPathVar).GetFiles("*.*",SearchOption.AllDirectories)

Each loop write to a column, same my code
ouput:


you can add title before write, and don’t need +index to write

the format isn’t what i want its not really clear, is it possible to have this format :
image

@Soudios

yes it can be done

Yes, change index and create column name before write file and folder name

do you have an exemple plz ?

Ok. I will edit with your format, then send to you

You can try
Soudios.xaml (10.7 KB)
edit value of
image
and where you want to write output
image
regards,

there is 2 xaml files and no invoke activity which one is the good one ?

foldercase.xaml (11.0 KB)
here, you can edit name of column
image

image

my ouput

What is the issue ? @Nguyen_Van_Luong1

image

@Soudios

passing of the variables in the add datarow should be same as the no of columns you have

This information is not fix, it can change, maybe next day a new file can be added

@Soudios

then you need to add another column for that file

as filename4

assign the filename to a variable and pass it to the add datarow

because you have mentioned some fixed column in the excel as your file number

Hope this helps

i found the issue, the folders are in a sharepoint folder so i need to connect to sharepoint first i think

@Soudios

oh ok

if you have any more issues let me know