开发者

Applescript to count files in subfolder not working

开发者 https://www.devze.com 2023-01-14 21:55 出处:网络
I cant seem to get this to work at all. Would be great if 开发者_如何学Pythonanyone could help or shine some light on it?

I cant seem to get this to work at all. Would be great if 开发者_如何学Pythonanyone could help or shine some light on it?

Thanks

on adding folder items to thisFolder after receiving thisItem

 try

  -- This gives you the name of the route folder, and the name of the added folder
  set folderName to name of (info for thisFolder)
  set itemName to name of (info for thisItem)

      -- I am trying to find out how many items the new folder that has been added to the route folder has but none of the variables below work
  -- Example: Route Folder > New Folder > # of files in new folder?
  set the numberOfFiles to the number of items in itemName
  set fileCount to (count (info for thisItem))
  set the item_count to the number of items in thisItem

  -- Dialog box to show information
  set the alert_message to (the folderName as text) & return & (the itemName as text) & return & (the item_count as text) as Unicode text
  display dialog the alert_message

 end try
end adding folder items to


if thisItem is a folder that you added do this...

tell application "Finder"
    if kind of thisItem is "Folder" then
        set itemsInTheFolder to items of thisItem
        set folderCount to count of itemsInTheFolder
    end if
end tell
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号