Quantcast
Channel: Get today’s date and use it in filename - Ask Ubuntu
Browsing all 6 articles
Browse latest View live

Answer by Sergiy Kolodyazhnyy for Get today’s date and use it in filename

Python can do this job as well. The small script for that would be the following:#!/usr/bin/env pythonimport time,osdate=time.gmtime()month =...

View Article



Answer by Sreedhar GS for Get today’s date and use it in filename

Running the commandecho "myfilename-"`date +"%d-%m-%Y"`gives this as the output:myfilename-21-02-2014

View Article

Answer by Dason for Get today’s date and use it in filename

I'm sure somebody else has a better way to do this but assuming you want month-day-year this should work: touch log`date +%m%d%y` and you can reorder the %m, %d, %Y to reflect the ordering you want....

View Article

Answer by Sergey for Get today’s date and use it in filename

One of the possible soultions:date +log%y%m%d | xargs touchcreates log111017

View Article

Answer by Florian Diesch for Get today’s date and use it in filename

You can format the output using the '+FORMAT' parameter, e.g.touch "log$(date +'%m%d%y')"See the manpage for what sequences you can use in FORMAT.

View Article


Get today’s date and use it in filename

Using the command-line, I want to create a log file with today's date in the name (for example, today is 05/17/2011, so the filename would have to be log051711).I know how to create the file (touch...

View Article
Browsing all 6 articles
Browse latest View live




Latest Images