• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 2935
  • Last Modified:

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!
0
MattLor
Asked:
MattLor
1 Solution
 
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

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now