Analyze subfolders

Hello friends,
@rkelchuri, @Ninett_Panfir, @Rammohan91, @balupad14, @Florent_Salendres, @vvaidya, @Palaniyappan, @ClaytonM, @vvaidya, @lakshman, @Dave

I need to count all the possile subfolders in a folder.
It is a variable number, not fixed.
I need to analyze the content of each subfolders (analyze files and transfer or move), the numer they are.
How can I implement that?
Thank you,
Cami
Cami

1 Like

Fine
use a string array variable like this
arr_outfile = Directory.GetFiles(yourfoldername,SearchOption.AllDirectories)
now this arr_outfile variable will have the list of file names in all the subfolders as well
–to get the count we can use
arr_outfile.Count.ToString

Cheers @CamiCat

1 Like

Thank you.
Which is the type of arr_outfile variable?

1 Like

string array
did that work buddy

Cheers @CamiCat

1 Like

NO :frowning:

what is the value of those two variables mentioned in the folderpath
Cheers @CamiCat

1 Like

i got it buddy
i missed out a argument to be mentioned
the expression should be like this
arr_outfile = Directory.GetFiles(yourfoldername,“**.*”,SearchOption.AllDirectories)

Cheers @CamiCat

1 Like

mention that *. in the argument which denotes any file and any file extension
Kindly let know if it works
i tried from my side it was working fine
Cheers @CamiCat

1 Like

Woooow, Now no errors.
I try.
And how to delete all subfolders inside a folder after moving files in them?
Cami :slight_smile:

@CamiCat
To retrieve subfolders you can assign…
arrVar=Directory.GetDirectories(YourMainFolderPath)

then use this variable in for each activity and then use delete file activity to delete subfolders.

image

1 Like

Hey @CamiCat

Are you looking Something like this - ?

Regards…!!
Aksh

2 Likes

Yes @aksh1yadav,

can you please provide a xaml please?
Thank you,
Cami


I can get only th files in a subfolder, not the ones in the second.
How an d why?
Cami

1 Like

you were almost done
no worries
hope this would help you to delete the subfolders in the folder we want

dellete.zip (9.4 KB)
Cheers @CamiCat

1 Like

Thank you @monika.c, doesn’t work.
image
How to fix?
Cami

Thank you @Palaniyappan,

how to delete empty folder?
Thank you,
cami

1 Like

@CamiCat
Check this sample workflow it work’s fine for me…Practice.xaml (38.5 KB)

1 Like

Can you please make it work also for empty folders?
Cami

1 Like

@CamiCat
The sample workflow works for empty folders also…