I have a folder with around 200,000 jpeg images. Below are the format of fileNames I can find
- BATCHID_GROUPID ex: 501234_20123.jpg
- BATCHID_GROUPID ex. 501235_20124_1.jpg, 501235_20124_2.jpg, 501235_20124_3.jpg. Each of this type images will have max of 10 images of BATCHID_GROUPID. What I mean is for this set the max will be 501235_20124_10.jpg
I need to take all the images that don’t end with _x or _xx i.e _1.jpg or _2.jpg or _10.jpg and pick the BATCHID and copy it and FTP it to a different location
For the ones that end with _x or _xx I need to pick BATCHID and create a folder with the name as batchID and move all the files that end with _X to _xx into the folder.
Thanks
Try using String.Split on your files names, check for length to determine where you are going to copy it and take the first index as your BATCHID:
Something like this: