Name of monitored folder as "inputAttributes" Applescript

I need your help, because I have not found a solution despite searching the forum and the Internet. I'm on the line there.
The following should happen:
If in the monitored folder (or subfolder) a file stays longer than X days, the name, not the path, of the folder should be passed to Applescript as "inputAttributes".
Getting the name is my problem.
If this does not work with the monitored folder, I could put the file in a subfolder.
The following should happen:
If in the monitored folder (or subfolder) a file stays longer than X days, the name, not the path, of the folder should be passed to Applescript as "inputAttributes".
Getting the name is my problem.
If this does not work with the monitored folder, I could put the file in a subfolder.