In /Home/Templates directory, we can put template file. So we can create new file by right clicking. Is there any way we can create new file which have current Date and Time. Something like log file. Which have date and Time as very first line. Or in the name of file.
Asked
Active
Viewed 644 times
1 Answers
0
This is not the solution for which I am looking for. But certainly good one.
Step-I
Create a file and put following command
#!/bin/bash touch $(date +"%Y-%b-%d_%H:%M:%S")Mark file for execution
chmod +x fileOr Right click on file and select properties. Under Permission tab, tick Allow executing file as program
Step-II
- Install
dconf-editorand run it. - Move to
org/gnome/nautilus/preferences. - Right click on
executable-text-activation. - Select launch from drop down menu.
- Install
Step-III
- Put that file in Templates folder.
Step-IV
- At any location (e.g. Desktop or Documents etc.), just right click and create that file there.
- Now double click it, it will create file with Date&Time as name.
Bash command for creating file with Name as DateTime and also as first line
#!/bin/bash
echo $(date +"%Y-%b-%d_%H:%M:%S") > $(date +"%Y-%b-%d_%H:%M:%S")
pomsky
- 70,557
Deepak Gautam
- 141