Scanning a folder and removing certain symbolic links

I’m trying to scan a folder than contains symlinks (to folders). I should have clarified what I am trying to do. In folderA i have some folders, in folderB are symbolic links to folderA. I would like to remove the symbolic links that have had their originals deleted from folderA.

set myFind to paragraphs of (do shell script "find -L " & quoted form of POSIX path of (choose folder) & " " & "-type l")

Also, when I add the “-delete” to the end, it removes all of the symlinks in the folder regardless of them working or not.

So I would like to run this script below on each result from the script above.

try 
do shell script "rm " & quoted form of myFind
end try

Any suggestions?

Well… what about reading the file? Than you do it like that.

set thelist to {}
list folder (path to home folder as alias)
repeat with i in result
	with timeout of 2 seconds
		if i does not start with "." and (folder of (get info for ((path to home folder as string) & i) as alias)) is false then set thelist to thelist & {name:(i as string), contents:(read (((path to home folder as string) & i) as alias))}
	end timeout
end repeat
return thelist

Then use what you get to scan and recognize the file type. What about file extensions?

After some more searching I believe I have this working.

set myFind to do shell script "find -L " & quoted form of POSIX path of (choose folder) & " " & "-type l"

repeat with matchpath in paragraphs of myFind
	set myfiles to quoted form of matchpath
	try
		do shell script "rm " & myfiles
	end try
	
end repeat