Notification when downloads folder exceeds a preset size

Discussion in 'Mac Apps and Mac App Store' started by jmh600cbr, Jun 2, 2015.

  1. jmh600cbr macrumors 6502a

    jmh600cbr

    Joined:
    Feb 14, 2012
    #1
    looking for an app that does this. please, thanks.
     
  2. Partron22, Jun 2, 2015
    Last edited: Jun 2, 2015

    Partron22 macrumors 68000

    Partron22

    Joined:
    Apr 13, 2011
    Location:
    Yes
    #2
  3. jmh600cbr thread starter macrumors 6502a

    jmh600cbr

    Joined:
    Feb 14, 2012
    #3
  4. jmh600cbr thread starter macrumors 6502a

    jmh600cbr

    Joined:
    Feb 14, 2012
    #4
    ok please help:
    I understand that StartCalendarInterval checks based on a time but i cannot find a launchd based on a folder exceeding a certain size. WatchPath keeps and eye on it, but can i set perameters? Thanks
     
  5. blackboxideas macrumors member

    Joined:
    Oct 17, 2012
    #5
    If you do want an app to do thins sort of thing (rather than a little service you create) I'd recommend Hazel - http://www.noodlesoft.com/hazel.php

    It'll do a lot more than just what you've asked, but that may be advantageous?!
     
  6. Partron22 macrumors 68000

    Partron22

    Joined:
    Apr 13, 2011
    Location:
    Yes
    #6
    Here's a little Applescript that'll check if the download folder is over 5gB, and send a notification with sound if it is:
    set z to path to downloads folder
    tell application "Finder"
    set dlsz to size of folder z
    end tell

    if dlsz is greater than 5.0E+9 then -- That's 5 gB. Set it for whatever you want
    display notification "It's HUGE!" with title "Downloads Folder " subtitle (dlsz as text) & " Bytes" sound name "Sosumi"
    end if
    return dlsz

    You can save this script as an App and have your launchd run it every two hours, or whatever.
     
  7. jmh600cbr, Jun 6, 2015
    Last edited: Jun 6, 2015

    jmh600cbr thread starter macrumors 6502a

    jmh600cbr

    Joined:
    Feb 14, 2012
    #7
    when trying to run this applescript in apple script editor

    "Expected “given”, “in”, “of”, expression, “with”, “without”, other parameter name, etc. but found unknown token.

    really appreciate your help!

    This is what i wrote:

    set z to path to "/Users/joshmharris/Downloads"

    tell application "Finder"

    set dlsz to size of folder z

    end tell



    if dlsz is greater than 2.0E+9 then -- That's 2 gB. Set it for whatever you want

    display notification “Your folder is massive!“ with title "Downloads Folder " subtitle (dlsz as text) & " Bytes" sound name "Sosumi"

    end if

    return dlsz
     
  8. Partron22 macrumors 68000

    Partron22

    Joined:
    Apr 13, 2011
    Location:
    Yes
    #8
    You're running into trouble with : vs / and trying to assign text as a path/alias.
    The standard "path to downloads folder" should work, and "set z to path to downloads folder" will give you an alias that points where you want it to.
     
  9. jmh600cbr thread starter macrumors 6502a

    jmh600cbr

    Joined:
    Feb 14, 2012
    #9

    set z to path to downloads folder

    tell application "Finder"

    set dlsz to size of folder z

    end tell



    if dlsz is greater than 2.0E+9 then -- That's 2 gB. Set it for whatever you want

    display notification “Your folder is massive!“ with title "Downloads Folder " subtitle (dlsz as text) & " Bytes" sound name "Sosumi"

    end if

    return dlsz


    still gives me the same error and points to the "Your...
     
  10. kryten2 macrumors 6502a

    Joined:
    Mar 17, 2012
    Location:
    Belgium
    #10
    Looks like a quotes issue. Use normal quotes e.g. " not smart quotes e.g. “ .
     
  11. Partron22 macrumors 68000

    Partron22

    Joined:
    Apr 13, 2011
    Location:
    Yes
  12. jmh600cbr thread starter macrumors 6502a

    jmh600cbr

    Joined:
    Feb 14, 2012
    #12
    thanks! you were right it was a smart quote issue, i feel dumb but not when i run it, it builds, but the results are "missing value" and no notification nor a sound plays. is it because it isn't finding the downloads folder?

    i suspected that may be cause by the folder being empty but i just tested that and it still gives a missing value result
     
  13. culb0743 macrumors member

    Joined:
    Feb 24, 2013
    #13
    Hazel can do this, and so much more. You could probably also set this up using a folder action in Automator. See this article on MakeUseOf for more ideas. Personally, I haven't used folder actions since I discovered the awesomeness that is Hazel.
     

Share This Page