Copy "date created" from Finder

Discussion in 'macOS' started by bLiss, Aug 14, 2010.

  1. bLiss macrumors member

    bLiss

    Joined:
    Jun 14, 2005
    Location:
    usa
    #1
    I'd like to copy the filename and the date created (basically, whatever my Finder's List View shows, which is minimal) so that I can paste it into a plain text document.

    Is there an easy way to do this without a script? As it stands, when I copy and paste to the text document, I just get the filename with its extension.

    Thanks.
     
  2. Gregg2 macrumors 603

    Joined:
    May 22, 2008
    Location:
    Milwaukee, WI
    #2
    I get the same thing, even when the Date Created heading is highlighted. An easy way? I guess not.
     
  3. Caleb531 macrumors 6502

    Caleb531

    Joined:
    Oct 17, 2009
    #3
    You can open a Get Info window for the file, and double-click the Date Created to select it. Then you can just copy and paste it.

    If you want the filename copied at the same time, there is no way to do that without a script.
     
  4. bLiss thread starter macrumors member

    bLiss

    Joined:
    Jun 14, 2005
    Location:
    usa
    #4
    Thanks for the reply, but Get Info doesn't seem to allow selecting or copying of anything. I wouldn't mind manually copying the date created if it were as easy as copying the filename somehow.
     
  5. Gregg2 macrumors 603

    Joined:
    May 22, 2008
    Location:
    Milwaukee, WI
    #5
    Ok, maybe it's time you revealed the OS you have.

    And what OS is that? Doesn't work here. (see above for my OS)
     
  6. Caleb531 macrumors 6502

    Caleb531

    Joined:
    Oct 17, 2009
    #6
    I'm using Snow Leopard, and it works for me (don't try it on the "Created:" text, try it on the actual date).
     
  7. angelwatt Moderator emeritus

    angelwatt

    Joined:
    Aug 16, 2005
    Location:
    USA
    #7
    Works perfectly fine for me with 10.6 as well.
     

    Attached Files:

  8. bLiss thread starter macrumors member

    bLiss

    Joined:
    Jun 14, 2005
    Location:
    usa
    #8
    10.5.8 Leopard. I'm assuming these features of Get Info are only in Snow Leopard.. so it seems.
     
  9. belvdr macrumors 603

    Joined:
    Aug 15, 2005
    #9
    I don't think Unix stores creation times, only modified times, in which case you can get via Terminal with:
    Code:
    ls -lt
     
  10. LPZ macrumors 65816

    Joined:
    Jul 11, 2006
    #10
    For creation time,

    Code:
     ls -lU
    or

    Code:
     ls -lUho
    for more human-friendly output.
     
  11. bLiss thread starter macrumors member

    bLiss

    Joined:
    Jun 14, 2005
    Location:
    usa
    #11
    So this might be a naive question but isn't Finder referencing some particular part of the file's metadata for the Date Created, and if so, why can't ls output that? I used variations of the ls command to get the creation date, only to find the modification date no matter what, as angelwatt pointed out.
     
  12. angelwatt Moderator emeritus

    angelwatt

    Joined:
    Aug 16, 2005
    Location:
    USA
    #12
    I'm actually getting mixed results. Depending on the app I use to edit the file, sometimes the created date gets changed to the new modified date. The -lU arguments were showing the creation date though. It simply wasn't obvious at first.
     
  13. angelwatt Moderator emeritus

    angelwatt

    Joined:
    Aug 16, 2005
    Location:
    USA
    #13
    I know you didn't want a script, but this Applescript will copy the currently selected file in Finder's name and creation date. It just does name, a space, then the date. Not very fancy, but I wasn't sure how you wanted it formatted. The code can easily be modified to do what you want. Then you can add it to the script menu (see below) then you can access the script straight from Finder.

    Code:
    tell application "Finder"
    	activate
    	set _folder to POSIX path of ((folder of the front window) as alias)
    	set _files to (get selection)
    	set _file to item 1 of _files
    	set _name to (name of _file)
    	set _fp to _folder & _name
    	set _date to do shell script "ls -lU " & quoted form of (_fp) & " | cut -d ' ' -f 9-11"
    	set the clipboard to (_name & " " & _date)
    end tell
    Turn on Script Menu:
    1. Open AppleScript Editor (10.6), Script Editor (<10.6)
    2. Go to Preferences
    3. General tab, check box for show script menu
     
  14. belvdr macrumors 603

    Joined:
    Aug 15, 2005
    #14
    Must be an HFS/HFS+ thing. I don't see that available on ext2/ext3/vxfs filesystems.
     
  15. bLiss thread starter macrumors member

    bLiss

    Joined:
    Jun 14, 2005
    Location:
    usa
    #15
    Thank you for your help but it's only returning the name for me. In fact, in my terminal ls -lU doesn't work due to the U.
     
  16. angelwatt Moderator emeritus

    angelwatt

    Joined:
    Aug 16, 2005
    Location:
    USA
    #16
    Hmm, I wonder is that argument was added in Snow Leopard then. I don't have a Leopard machine handy to check right now, but if you enter the command "man ls" it will show you the help page and you can go down and see what arguments it does support. Hit q to quit out of the help.
     
  17. angelwatt Moderator emeritus

    angelwatt

    Joined:
    Aug 16, 2005
    Location:
    USA
    #17
    I confirmed Leopard does not have the U argument for the ls command. I found an alternative way to do the AppleScript that doesn't require the ls command.

    Code:
    tell application "Finder"
    	activate
    	set _folder to POSIX path of ((folder of the front window) as alias)
    	set _files to (get selection)
    	set _file to item 1 of _files
    	set _name to (name of _file)
    	set _date to (creation date of _file)
    	set {year:y, month:m, day:d, hours:h, minutes:m} to _date
    	set the clipboard to (_name & " " & _date)
    end tell
    The _date variable will have a format like,
    Code:
    Monday, August 16, 2010 5:12:07 PM
    which may not be what you want. I set some variables in the script that grabs the individual pieces such as year, month, etc. and assigns them to variables. You can then form whatever output string you want.
     

Share This Page