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

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!
MattLorAsked:
Who is Participating?
 
Eoin OSullivanConsultantCommented:
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.


0
 
venkateshwarrCommented:
The use of colons is discoraged. Try creating a directory with colons in terminal and see it in Finder.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.