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

Make file with name equal to current date / time in Unix

What is the easiest way create a file with a name equal to the current date time? I would like to run the same script and have the files saved in the same location with names that change based on date/time.

Ideally, if the time was 9:43 on August 3, 2007 the output would be filename_2007.08.03_21:43

I thought this would be trivial but I have scoured the web and have not found any answers. I am using terminal in OS X. Please Help!!!
1 Solution
touch filename_`date +%Y.%m.%d_%H:%M`
MattLorAuthor Commented:
THANKS for the quick response! You saved me hours! I had seen this solution somewhere else but was using single quotation marks instead of hash marks.
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.

Join & Write a Comment

Featured Post

Cloud Class® Course: Microsoft Windows 7 Basic

This introductory course to Windows 7 environment will teach you about working with the Windows operating system. You will learn about basic functions including start menu; the desktop; managing files, folders, and libraries.

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