Script run in every folder.

Okay, now how would I make this script to run in every folder?

tell application "Finder" to set extension hidden of every file of the front window to true

I tried the following but it didn’t work.

tell application "Finder" to set extension hidden of every file in every folder of the startup disk to true

Save this as an application. You can drop folders, files, or volumes on it. Try it on a single file and a folder with just a few items to test before you drop your whole home folder. It will take a long time to run…

on open these_items
	repeat with i from 1 to the count of these_items
		set this_item to (item i of these_items)
		set the item_info to info for this_item
		if folder of the item_info is true then
			process_folder(this_item)
		else if (alias of the item_info is false) then
			my process_item(this_item)
		end if
	end repeat
end open


-- this sub-routine processes folders
on process_folder(this_folder)
	set these_items to list folder this_folder without invisibles
	repeat with i from 1 to the count of these_items
		set this_item to alias ((this_folder as text) & (item i of these_items))
		set the item_info to info for this_item
		if folder of the item_info is true then
			process_folder(this_item)
		else if (alias of the item_info is false) then
			my process_item(this_item)
		end if
	end repeat
end process_folder


-- this sub-routine processes the files
on process_item(this_item)
	
	tell application "Finder" to set extension hidden of this_item to true
	
end process_item

This will work on all files inside a given folder(s):

on run
	choose folder with multiple selections allowed
	open result
end run

on open theseFolders
	repeat with thisFolder in theseFolders
		tell application "Finder"
			set extension hidden of files of entire contents of thisFolder to true
		end tell
	end repeat
end open