'I haven't used Automater before and am interested in learning more about it.' -
'Automator for AppleScripters',
'Guides: Apple Applications, Automator',
'Google'.
'Can someone tell me to go about using it so I can run a script on an entire directory and remove "_SOMETHING" from each file that it's located in?' - ...
01. (Library) 'Finder', (Action) 'Ask for Finder Items', [(optional) Change 'Prompt:' string].
02. (Library) 'Finder', (Action) 'Get Folder Contents', [(optional) 'Repeat for each subfolder found'].
03. (Library) 'Automator', (Action) 'Run AppleScript', [Replace contents of module / panel with (1)]
(1) - ...
on run {input, parameters}
repeat with i in input
set FREF to open for access i with write permission
set tText to read FREF
--
-- Your code to locate and filter out "_SOMETHING" here.
-- The following 'write' line assumes the (searched and modified contents') variable will remain 'tText'.
--
set eof FREF to 0
write tText to FREF
close access FREF
end repeat
return input
end run
----- ----- ----- -----
AppleScript alternative:
set tFolder to choose folder with prompt "Select desired folder: " default location (path to desktop from user domain) without multiple selections allowed
set folder_Contents to list folder tFolder without invisibles
repeat with i in folder_Contents
set FREF to open for access (((tFolder as string) & i) as alias) with write permission
set tText to read FREF
--
-- Your code to locate and filter out "_SOMETHING" here.
-- The following 'write' line assumes the (searched and modified contents') variable will remain 'tText'.
--
set eof FREF to 0
write tText to FREF
close access FREF
end repeat