How can I set the crontab to create, say for example, text files with dynamic file names? What I mean is, for instance, I will set the crontab that a text file will be created every minute in a directory. Then the filename that will be assigned to a text file will be depending on what time of the day it is.
Illustration:
0001.txt
0002.txt
0003.txt
0004.txt
…
and so on and so forth.
(Though the example above does not show text file names of the time of the day, you will get the point)
The
datecommand can be used to get the current date and time in the format you want for the files.Will, right now for me, create a file named “2011-11-12_0905.txt”.