change "date added" of a file?

Discussion in 'macOS' started by .mark., Feb 28, 2008.

  1. .mark. macrumors 6502

    Joined:
    May 28, 2007
    Location:
    Jersey, C.I.
    #1
    I'm using the drawers icons with stacks in leopard and I love them. The only problem I'm having is with the icon for the download stack. The meta data is set ok for the date modified and date created but i want to order the stack by date added. I googled around a bit and found that using the touch command from the terminal you can edit the date modified and created but does anyone know how I can modify the a file's "date added" so I can have the stack ordered by date added and keep my icon at the front?
     
  2. todd2000 macrumors 68000

    Joined:
    Nov 14, 2005
    Location:
    Danville, VA
    #2
    Found this thread while searching Google. I would like to know this too, there must be a way through terminal or something?
     
  3. MagicTom macrumors newbie

    Joined:
    Jun 25, 2007
    #3
    Another one coming through Google. This is really frustrating -- Date Modified just isn't cutting it here!
     
  4. Mitthrawnuruodo Moderator emeritus

    Mitthrawnuruodo

    Joined:
    Mar 10, 2004
    Location:
    Bergen, Norway
  5. pats-madin macrumors newbie

    Joined:
    Dec 29, 2007
    #5
    If you change the date on your computer to the date you want and save the files with a different name then it'll save it with that date... although with a lot of files this would be really tedious... and dont forget to change the date back
     
  6. dvd macrumors regular

    dvd

    Joined:
    Oct 12, 2007
    Location:
    Massachusetts
    #6
    hmmm, per this interesting thread from another site the Date Added field is not going to be an easy thing to tweak.. looks like it's buried in an SQLite database, ~/Library/Preferences/com.apple.dock.db and not something easy to tweak with touch like the ctime, mtime, or atime.
     
  7. Sobtanian macrumors newbie

    Joined:
    May 15, 2008
    #7
    Hello, stumbled here via google also :)

    Having not found an easy way to change the Date Added variable, I wrote a small script that does the following:

    Every time a file is added to the Downloads folder, it deletes the drawer icon and copies it back in, hence making it the last file added, ie on top of the stack :) The delete is direct (ie no trash can).

    Using the script is easy, all the instructions are within it. Just download the attached .zip and put it in ~/Library/Scripts/Folder Actions Scripts. Unzip it there and open the cdo.scrpt file for further instructions.

    This is a very crude fix, and the script just runs a CLI script to delete and copy the folder icon. Still, it works and will let us have a nice stack with an icon that is arranged by Date Added.

    Hope this helps until someone more clever fixes it properly ;)

    Any questions let me know.
     

    Attached Files:

    • cdo.zip
      File size:
      3.3 KB
      Views:
      526
  8. Dany M macrumors 6502

    Joined:
    Jun 18, 2007
    Location:
    Earth
    #8
    what does ~ mean again, home library or the mac hd library???

    I tried doing thos but it is not working?
     
  9. dvd macrumors regular

    dvd

    Joined:
    Oct 12, 2007
    Location:
    Massachusetts
    #9
    ~ = the user's home directory

    more specifically

    ~ = your home directory
    ~bob = bob's home directory
     
  10. Dany M macrumors 6502

    Joined:
    Jun 18, 2007
    Location:
    Earth
  11. ImNotJimboJones macrumors newbie

    Joined:
    Dec 19, 2007
    #11
    As far as i can see, the only effective way to keep a file/folder on top of a stack using "Date Added" sorting is to move the file/folder via applescript as in Sobtanian's post.

    For the curious, one can easily edit the SQLite database file ~/Library/Preferences/com.apple.dock.db to change the order of the files in a stack. Unfortunately, this is a futile effort toward our goal. When a new file is added to a stack, a new entry is added to the database with the order number set to one more than the highest order number presently in the database. In other words, if you change the order number of your stack overlay to 99999999998, the next file added to the stack will be given the order number 99999999999, putting it on top.
     
  12. belvdr macrumors 601

    Joined:
    Aug 15, 2005
    #12
    What if you go to Terminal and do a:
    Code:
    touch <directory or filename>
     
  13. ImNotJimboJones macrumors newbie

    Joined:
    Dec 19, 2007
    #13
    That would be a solution to sorting by Modification Time... This thread is related to sorting by Date Added.
     
  14. Mark Lee macrumors newbie

    Joined:
    Nov 22, 2009
    #14
    Sorry for necro-posting. Found thins thread via Google, but didn't like the solution of a script. So I found a solution with Folder Actions in Automator.

    Here are the steps:
    1. http://dl.dropbox.com/u/588592/lj/automator-date-added.png (just a screenshot of the actions)
    2. File -> Save -> Enter the name for your new action.

    Now everytime any file goes to the Downloads folder, the Folder Action runs automatically and moves the icon file back and forth making it the last file added to the folder.
     
  15. ImNotJimboJones macrumors newbie

    Joined:
    Dec 19, 2007
    #15
    That works too, but believe it or not, both solutions are identical. The only difference is that you are using Automator to write your folder action rather than straight applescript. As a software engineer, I naturally think in code and don't mess with Autormator much, but your method is obviously an easy shortcut, so virtual high-five on that. ;)
     
  16. dburr macrumors newbie

    Joined:
    May 15, 2015
    #16
    If you own Noodlesoft's Hazel, doing this is trivial and doesn't require Folder Actions to be enabled separately. Here's how I did it. I created a new rule for the Downloads folder, I called it "Move Downloads Icon to Top." Here's how I set up the rule. (Note: any text after a "#" sign is a comment from me and is not part of the rule)

    If ALL of the following conditions are met:
    * Any File
    * Name does not contain ".download" # otherwise every time you start downloading a file in Safari, this rule would fire
    * Name does not contain "Download" # my download drawer icon is named "Download.app", so we don't want the rule to trigger whenever it gets re-copied in

    Do the following to the matched file or folder:
    * Run shell script:
    cp -a $HOME/Downloads/*ownload*.app /tmp; rm -rf $HOME/Downloads/*ownload*.app; cp -a /tmp/*ownload*.app $HOME/Downloads

    # Note that my version copies the file into /tmp, deletes it, then re-copies it back in, avoiding the need to keep a template copy of it in some other location.
     
  17. DennisBlah macrumors 6502

    DennisBlah

    Joined:
    Dec 5, 2013
    Location:
    The Netherlands
    #17
    'A better finder attributes' is worth trying, its simple to use and helped me out a lot of times with an 'autoUpdater' application I created for the company.
     

Share This Page