Hello everyone,
My knowledge of Applescripts spans about 1 hour and I am trying to modify the script below. I am trying to get a directorys name to reflect the number of files within the directory but I am having trouble appending the number of files to the original directory name. For example, if the directorys name is “A” I would like it to say A (52). Currently I can only get it working bt defining the string “A” when it renames the folder. How would I go about saving the old Folder name to a variable so it can be used in the new directory name.
any help is greatly appreciated.
thanks!
on adding folder items to thisFolder after receiving addedItems
my setTheCount(thisFolder)
end adding folder items to
on removing folder items from thisFolder after losing addedItems
my setTheCount(thisFolder)
end removing folder items from
on setTheCount(theFolderAlias)
tell application "Finder"
set theFolder to (folder theFolderAlias)
set myCount to the count of (every item of theFolder)
set nameEnd to ""
if myCount > 0 then set nameEnd to " (" & myCount & ")"
set name of theFolder to ("A") & nameEnd
end tell
end setTheCount