Hey,how to select a folder using select folder, then loop throughout the folder, then using split activity to findout their extension and then to sort them to a new folder according to their extension
Example.: If my folder consists of 3 pdf , 2 jpg , i want the final output to be 3 pdf files should be under a new folder named pdf and likewise others. Using split activity must
Can Do!
Iβve attached a nifty workflow to help get you started.
Loop Through a Specified Directory - Return File Path and Extension.xaml (6.2 KB)
There are a few elements here - I took care of the items in bold for you. I bet you can figure out the rest!
Please let us know if you need more help!
- Ask a user to select a directory
- Use the Directory.GetFiles Command to get every file in the specified directory
- Loop through every file in the specified directory
- Use the Path.GetExtension Command to get the extension for each file
- Create a folder using the extension name
- Move the file to that folder
Get a list of files in a selected directory - Directory.GetFiles(FilePath)
Get the extension for a file - Path.GetExtension(filePath)
No, Iβm just practicing,
Can we use split activity to split file names and get extension, like split using β.β and finding extension
Hello,
Instead of using split method, itβs easy if you use syntax
Path.GetExtension(filepath)
Assign this to variable inside the loop
I sent this in a DM but Iβm throwing it in here in case it can help someone else!
Find Extension - Split Command and Last Command.xaml (5.1 KB)
Assuming 1 β.β
String.Split("."c)(1).ToString
Assuming 1 or more β.β
String.Split("."c).Last.ToString