I had images in subfolder. I want to upload those on web. I had main folder path in variable now sometimes images are in main folder and sometimes images are in subfolder under main folder. how to upload them on web.
Hey @Puneet_Singh ,
Use this expression to get all the file which are present in the subdirectories:
Directory.GetFiles("mainFolder", "*.*", SearchOption.AllDirectories)
Thanks,
Sanjit Pal
Environment.GetFolderPath(Environment.SpecialFolder.UserProfile)+“\Downloads\”+ fileName
in file name variable is my folder name and when i am passing this in your solution it showing an error.
you want to select all the files at once or one by one and also please let me know the extension of file that you wants to upload.
all at once.
Try this
String.Join(",",Directory.GetFiles(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.UserProfile),"Downloads"),"*.png",SearchOption.AllDirectories))
What if any of the file is in .png
this current code is looking for .png files only
sorry i mean .JPG
Both types
You can try using for each file in folder activity and check the include sub folder check box to search sub folders as well
And inside that currentfile.FullName will give the fullpath of file
Cheers
Yes, it might not be working as there would be lot of files and the string characters are going beyond the limit of that test box, in that case you can try the suggested method of @Anil_G
Directory.GetFiles(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.UserProfile),"Downloads"),"*.png",SearchOption.AllDirectories)
this will return the array of string that you can use with for each activity to upload the file one by one.