I have a folder with file names like this:
- 000001_001_m
- 000001_002_m
- 000001_003_m
- 000001_004_m
- 000002_001_m
- 000002_002_m
- 000003_001_m
The first six characters correspond to a unique identifier in an Access database, and all content after the first _ corresponds to the page number of the scanned item.
I'm looking for a way to take a list of unique identifiers in a csv file, find all files in a folder with matching identifiers, and move them to another folder. Any advice on how to do this?
After getting the identifiers you could get unique identifiers by converting your list into a set.
After that you could use
glob
module to find all the filenames matching your pattern (identifier_*
). And usingshutil.move
move found files to destination folder.