Modifying the "Date Modified" date?? Possible?

Discussion in 'OS X' started by Khryz, Oct 27, 2010.

  1. macrumors 6502a

    Joined:
    Jan 7, 2007
    #1
    Can someone tell me if there's a way to manually modify the "Date Modified" date on a file?

    I have these overlay "Drawers" for my folders that make it look like the contents of my Movies, Docs, Downloads, etc are in a drawer but the drawers will only be in front if the Date Modified is obviously the newest.

    I DL'ed these when Leopard first came out and they were "hacked" I guess to say October 26th, 2010. Well, yesterday is over so now my Drawers are in the middle of the folders.

    Can someone help?
     
  2. macrumors 68030

    RaceTripper

    Joined:
    May 29, 2007
    #2
    From the Terminal use the 'touch' command.
     
  3. LPZ
    macrumors 65816

    Joined:
    Jul 11, 2006
    #3
    This can be done from Terminal using the SetFile command, but I don't know if this command is available if you haven't installed the Xcode Developer Tools. You could give this a try, in any case:

    Open Terminal (in Utilities) and enter the following but don't press return. Leave a space after the closing quotation mark:

    Code:
    SetFile -m "1/1/2020 10:10" 
    Then drag the file you want to modify and drop it in the Terminal window. This will append the file's path to the SetFile command. Click on the Terminal window to make it active, and then press return.

    [EDIT]

    As suggested by RaceTripper, you don't need the SetFile command for this type of file modification. So instead of the above, you can do this:

    Open Terminal (in Utilities) and enter the following but don't press return. Leave a space after the final 0:

    Code:
     touch -m -t 202012311010 
    Then drag the file you want to modify and drop it in the Terminal window. This will append the file's path to the touch command. Click on the Terminal window to make it active, and then press return.
     
  4. LPZ
    macrumors 65816

    Joined:
    Jul 11, 2006
    #4
    This will set the modification date to the current date. I think the OP wants to set the modification date to a "distant" future date, so he doesn't need to keep "touching" the file.
     
  5. macrumors 68030

    RaceTripper

    Joined:
    May 29, 2007
    #5
    You can specify the access and/or modification date of a file with touch. From the Terminal, type 'man touch' to see the options.

    Unix was useful long before the Mac came to town. ;)
     
  6. LPZ
    macrumors 65816

    Joined:
    Jul 11, 2006
    #6
    Thanks, you're right.
     
  7. macrumors 68030

    RaceTripper

    Joined:
    May 29, 2007
    #7
    I learned something too. I didn't know about SetFile. :)
     
  8. thread starter macrumors 6502a

    Joined:
    Jan 7, 2007
    #8
    Just curious before I attempt this but what's with the warning of not pressing Enter. Will that severely damage my computer or something?
     
  9. macrumors 68030

    RaceTripper

    Joined:
    May 29, 2007
    #9
    You gonna need to provide us a little more context.
     
  10. LPZ
    macrumors 65816

    Joined:
    Jul 11, 2006
    #10
    If you're referring to "but don't press return" then no, pressing return will not do any damage. If you press return before dragging the file into the Terminal window, then you'll enter an incomplete command and the system won't know what file you are trying to modify. You'll get a harmless warning message that tells you what you should have done. The warning looks like this:

    Code:
    usage: touch [-acfm] [-r file] [-t [[CC]YY]MMDDhhmm[.SS]] file ...
    
     
  11. thread starter macrumors 6502a

    Joined:
    Jan 7, 2007
    #11
    Oh ok thanks you two.

    I will try this and let you know if I need anymore help.
     
  12. thread starter macrumors 6502a

    Joined:
    Jan 7, 2007
    #12
    So, this isn't working. I am getting "No such file or directory" when I do this.

    What am I doing wrong?
     
  13. macrumors 68030

    RaceTripper

    Joined:
    May 29, 2007
    #13
    Hard to say if you don't show what it is you are doing (like the exact command you are invoking).
     
  14. thread starter macrumors 6502a

    Joined:
    Jan 7, 2007
    #14
    with the FILENAME being the file I drag into the Terminal window. Basically the same command line as what's earlier in this thread.

    Then I just go into my Applications folder where I have my Applications Drawer Icon .. select it then drag into Terminal. Click the Terminal window .. then hit enter.
     
  15. macrumors 68030

    RaceTripper

    Joined:
    May 29, 2007
    #15
    Works for me:
    me@myhost: desktop $ touch -t 209901311234 /Users/me/Desktop/test.txt
    me@myhost: desktop $ ls -l test.txt
    -rw-r--r-- 1 me staff 0 Dec 26 1962 test.txt

    Do you have spaces in your path? If so you'll need to enclose the path in quotes, or you need to escape the space characters with \ before each space.
     
  16. thread starter macrumors 6502a

    Joined:
    Jan 7, 2007
    #16
    The only spaces I have are what I see from the quote .. touch[space]-t[space]the#'s[space]theFile .. not right?
     
  17. LPZ
    macrumors 65816

    Joined:
    Jul 11, 2006
    #17
    Actually, any spaces in the path should be automatically escaped when the file is dropped into the Terminal window. At least, that's what happens for me. :)
     
  18. LPZ
    macrumors 65816

    Joined:
    Jul 11, 2006
    #18
    Please copy the line you get in Terminal after dropping your file into the window but before pressing return. Post here.
     
  19. thread starter macrumors 6502a

    Joined:
    Jan 7, 2007
    #19
    After I put in the command then drag the file in I get this:


    > \
    > \
    > \
    > D R A W E R S i c o n\
    > \
    > [ optica optima ]\
    > http://optica-optima.blogspot.com/\
    > ©2007 Yasushi Chida, All Right Reserved.

    This this once I hit Enter:

    touch: http://optica-optima.blogspot.com/: No such file or directory
     
  20. macrumors 68030

    RaceTripper

    Joined:
    May 29, 2007
    #20
    That's not a file path. It looks like contents of a file. The argument to touch is a valid path to a local file, as in my example above.

    It would serve you well to grab a copy of O'Reilly's "Learning the bash shell" because you are missing some really key concepts about using the Mac via a command shell.
     
  21. LPZ
    macrumors 65816

    Joined:
    Jul 11, 2006
    #21
    OK, that's not right. I think the files you want to drag are the "Drawers" that are currently appearing in the middle (rather than the front) each of your folders. Try it for "Drawer" file in your Downloads folder. This file is probably some sort of image file; maybe a .jpg
     
  22. thread starter macrumors 6502a

    Joined:
    Jan 7, 2007
    #22
    Yeah, that's what I did. I opened Finder .. went into the folder with the icon in it and dragged it into Terminal.

    http://cl.ly/33RQ

    Those are the Drawers that I use if anyone wants to quickly DL them and take a look .. obviously I am messing something up.
     
  23. LPZ
    macrumors 65816

    Joined:
    Jul 11, 2006
    #23
    Please do this. In Terminal, enter

    cd ~/Downloads; ls

    and press return. The character before the final "s" above is a lowercase L.

    Post what you get.
     
  24. thread starter macrumors 6502a

    Joined:
    Jan 7, 2007
    #24
    All I have in my Downloads folder is that .zip file I uploaded. Did I pass? Lol.
     
  25. LPZ
    macrumors 65816

    Joined:
    Jul 11, 2006
    #25
    Please repeat the process described earlier. Drag the file named Download .app from the Downloads folder into the Terminal window.

    That should modify the date for that file.
     

Share This Page