Hey, I am trying to get a script to search a file name for only a numeric or alphanumeric combination. my files are in these formats: "2802282_hho_s.tif" "2802282_hho.tif", or "h2802282_hho.tif"
I need to be able to search the numbers only before the underscore.
example.
if I have a list of numbers:
2820052
2846645
f2265688
That correspond to files:
2820052_chb.tif
2846645_acr_s.tif
f2265688_hho.tif
and I want the files to be marked, can I search for filenames contain numbers in txt file, instead of having to add the "_chb.tif" to every number in the list. I am going to be searching about a terabyte or more of images.
The current code I have (thanks to Hhas in another thread) allows me to get it to work, if I add the information after the underscore manually into the text file.
Anyone out there know how I can do this?
I need to be able to search the numbers only before the underscore.
example.
if I have a list of numbers:
2820052
2846645
f2265688
That correspond to files:
2820052_chb.tif
2846645_acr_s.tif
f2265688_hho.tif
and I want the files to be marked, can I search for filenames contain numbers in txt file, instead of having to add the "_chb.tif" to every number in the list. I am going to be searching about a terabyte or more of images.
The current code I have (thanks to Hhas in another thread) allows me to get it to work, if I add the information after the underscore manually into the text file.
Code:
try
set theFolder to (choose folder with prompt "Choose a folder.")
set textFile to (choose file with prompt "Choose a text file." without invisibles)
set fileNames to every paragraph of (read textFile as string)
tell application "Finder"
set label index of (every item whose name is not in fileNames) of entire contents of theFolder to 3
end tell
on error theError
display dialog theError buttons {"OK"} default button 1
end try
Anyone out there know how I can do this?