In the input folder, the following files are stored:
ABC_TTT_20250901.txt
PAA_20250901.txt
PCA_20250901.txt
PPM20250901.xlsx
PPM20250902.xlsx
ABC_TTT_20250904.txt
PAA_20250904.txt
PCA_20250904.txt
PPM20250904.xlsx
The requirement is to check for sets of files that share the same date suffix, specifically:
ABC_TTT_xxxxxxxx.txt
PAA_xxxxxxxx.txt
PCA_xxxxxxxx.txt
PPMxxxxxxxx.xlsx
If all four files with the same date exist, extract the date value, move these files to the current folder, perform further processing, and then continue checking the next available date.
First use assign with Directory.GetFiles("Folder","ABC_TTT_*") this gives list of files paths which exists for ABC_TTT
Now loop on these files and extract the date value from the pathโฆcurrentitem.split("ABC_TTT_").Last.Replace(".txt","") will give the date value
Now use the date value to check if remaining files with the name and date exists uisng for each file or directory.getfiles..if all are present move the files else continue loop
Hello @Stef_99 You can try this 1)Get files Using Directory.GetFiles("input").
2)For each file use Regex to extract the 8-digit.
3)Store files in a dictionary (key = date, value = list of files).
4)For each date, confirm all 4 required files (ABC_TTT, PAA, PCA, PPM).
5) If set is complete, use Move File to current folder.