Create file name equal to current date / time in OS X terminal

Posted on 2007-08-03
Last Modified: 2013-11-05
I new to OS X terminal and would like to be able to name files/folders using the current date and time. I have scoured the web for an answer to this but have not come up with anything.

Here is what I want to do:

If the time is 11:30 on January 20 2007, this command

Mkdir FolderName "date "+%y.%m.%d %H:%M:%S"

would create this directory

FolderName 07.01.20 11:30:05

What is the correct command to create such a directory? This can't be that hard right?!? Thanks for your help!
Question by:MattLor
    LVL 39

    Accepted Solution

    The correct syntax is

    mkdir FOLDERNAME_`date +%d.%m.%Y_%H.%M.%S`

    To create a folder with the colons in the name is a bad idea from a cross-platform compatibility point of view.

    LVL 12

    Expert Comment

    The use of colons is discoraged. Try creating a directory with colons in terminal and see it in Finder.

    Featured Post

    Looking for New Ways to Advertise?

    Engage with tech pros in our community with native advertising, as a Vendor Expert, and more.

    Join & Write a Comment

    Preface   In the first 100 days of the Macintosh release in January 1984, Apple sold 72,000 of the computers. Relatively cheap, easy-to-use personal computer with a graphical operating system. I've never seen this model. I did see this one:   …
    Do you come here a lot? Are you lazy like me and don't want to go through the "trouble" of having to click your Dock's Safari icon and then having to click your Experts Exchange Favorites bookmark to get here? Well then this article is for you.
    Migrating to Microsoft Office 365 is becoming increasingly popular for organizations both large and small. If you have made the leap to Microsoft’s cloud platform, you know that you will need to create a corporate email signature for your Office 365…
    In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor ( If you're interested in additional methods for monitoring bandwidt…

    754 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    14 Experts available now in Live!

    Get 1:1 Help Now