Move the files in another folder but if the file ends with a number (ex. filename1.txt) it will be excluded
I have some clue on what to use but when i start to implement them; like using getfileinfox, regex, foreach and movefile but when I start to implement the activities, im getting an error. Please help. thank you
Create a variable filePaths of type System.String[].
Use the “Assign” activity to set filePaths to Directory.GetFiles("yourFolderPath").
Build Data Table:
Use the “Build Data Table” activity to create a DataTable named dtFiles with columns “FileName” and “FilePath.”
For Each Activity:
Use a “For Each” activity to iterate through filePaths.
If Activity (Inside For Each):
Use an “If” activity inside the loop.
Condition: Not System.Text.RegularExpressions.Regex.IsMatch(Path.GetFileNameWithoutExtension(item.ToString), ".*\d$")
(This condition checks if the file name without extension doesn’t end with a number.)
hello, thanks for the answer. i need some clarification in “not” condition, unfortunately, its not in the option; I assume the condition is “is false” or “not equal to?” thanks
@Parvathy
Hello, regarding this one “{Path.GetFileName(item.ToString), item.ToString}”
The item mentioned there is the item in foreach right? if my variable is currentItem, then it’ll be {Path.GetFileName(currentItem.ToString), currentItem.ToString}?
Also this one, when running the file, this error occurs