Display the name of the sub folder

Hi,

I want to display the name of my Subfolder. The name of the subfolder is not static, i.e. it keeps on changing whereas the name of its parent folder is static.

For example:

where:
current folder is any folder location with any name
“My First Folder” is the parent folder of my sub-folder and its name is “My First Folder” always.
mysubfolder is a folder inside “My First Folder” and its name can be anything

I tried to achieve like this, but failed…


tell application "Finder"
	
	set theLocation to (target of front window) as string
	set MyFol to "My First Folder"
	set MySubFolder to folder of MyFol of theLocation
	display dialog MySubFolder
end tell

any ideas !

P.S.: There is only subfolder in the parent folder “My First Folder”, but current folder have many.

Thanks for trying… However, I got it by myself… Here is the final script for your reference… Enjoy it…


tell application "Finder"
	set theLocation to (target of front window)
	set MyFol to (1st item of theLocation whose name is "My First Folder") as string
	set MySub to (1st folder of folder MyFol) as string
	set SubName to name of folder MySub
	display dialog "Sub folder name is: " & SubName
	
end tell