Moving Files into another Directory, also with Duplicates

Hello,

i wann know how can i Move Files with Specific File Names incl. Duplicates into another directory?

so my file list looks like this:

12345.pdf
12345(1).pdf
12345(2).pdf
54321.pdf
43224.pdf

And i wanna Move the 12345.pdf + 12345(1).pdf + 12345(2).pdf

Hi @Beere_Plays
A regex based approach

use Move File Activity inside loop body

(From fi In New DirectoryInfo("C:\_RPA\_Demo").GetFiles()
Where Regex.IsMAtch(fi.Name,"\(\d+\)\.docx$", RegexOptions.IgnoreCase)
Select fi.FullName).toArray

ensure that following namespaces are imported:
grafik

optionally:

  • we can prefilter to a extension as well
  • modify the regex pattern also to catch typically abc (1) Copy.docx cases

Hi @Beere_Plays you can also use the following method:

  1. GetfilesVar=Directory.GetFiles(“path of the files,”.pdf")----->(".pdf") is optional, if you want to move any files then don’t use this

  2. Use for each loop

  3. Use move file activity inside the for each loop and pass the destination address where you want to move the files and in source , you just pass the for each “item” parameter.

Note: Data type of GetfilesVar should be array of string