list files with no extension

how do i do the list files thing, but get the names of the files without the extension?

This will get the base names (without extension) of every file in the chosen folder, including those in folders within as a list called BNames.


tell application "Finder" to set L to (files of entire contents of (choose folder)) as alias list
set BNames to {}
repeat with aFile in L
	tell (info for aFile) to set end of BNames to name's text 1 thru ((my (offset of ("." & name extension) in name)) - 1)
end repeat

great thanks!

You’re welcome. If you want to give a user a choice among these base names and then get an alias to the file referred to, this is one way to do it:


tell application "Finder" to set L to (files of entire contents of (choose folder)) as alias list
set BNames to {}
repeat with aFile in L
	tell (info for aFile) to set end of BNames to name's text 1 thru ((my (offset of ("." & name extension) in name)) - 1)
end repeat
set C to (choose from list BNames) as string
repeat with F in L
	if C is in name of (info for F) then
		set P to contents of F
		exit repeat
	end if
end repeat

P is an alias to the file with the chosen base name.