Solved

Generate  a filename that include date and time

Posted on 2013-11-13
7
449 Views
Last Modified: 2013-11-13
Hi,

I'm using in Ubuntu the command "import capture.png" to save a screen capture to the file capture.png, but I need that every time that I run this command, the filename will be updated include the date and time , for example:

capture2013-11-14-2200.png or something like this

I try to with the command "import capture$date(%Y-%m%d)" but doesn't work.

Could you give me the command to dynamic generate the filename including datetime stamp?

Thanks in advance
0
Comment
Question by:lnrivera
  • 3
  • 3
7 Comments
 
LVL 84

Accepted Solution

by:
ozo earned 500 total points
ID: 39644043
import capture$(date +%Y-%m-%d-%H%M).png
0
 

Author Comment

by:lnrivera
ID: 39644111
Thanks, but your command generate a file named "capture$(date +%Y-%m-%d-%H%M).png"

I see that between date and + there are a space, I try with and without space with the same results

I'm using Ubuntu 10.04 LTS

Regards
0
 
LVL 84

Expert Comment

by:ozo
ID: 39644118
Which shell are you using?
If it doesn't understand $(date +%Y-%m-%d-%H%M), try `date +%Y-%m-%d-%H%M`
0
VMware Disaster Recovery and Data Protection

In this expert guide, you’ll learn about the components of a Modern Data Center. You will use cases for the value-added capabilities of Veeam®, including combining backup and replication for VMware disaster recovery and using replication for data center migration.

 

Author Comment

by:lnrivera
ID: 39644124
The standard for Ubuntu, I think that is bash.

The other option is including the character ' ?
0
 
LVL 84

Expert Comment

by:ozo
ID: 39644150
bash understands $(), what was the exact command you used?
Where do you want to include the character ' ?
You can include it literally by enclosing it in "'", otherwise $() and `` would both be disabled inside ''
0
 
LVL 48

Expert Comment

by:Tintin
ID: 39644328
import capture$(date +%Y-%m-%d-%H%M).png

won't produce a file called

capture$(date +%Y-%m-%d-%H%M).png

Can you please copy/paste the exact command you are running.
0
 

Author Closing Comment

by:lnrivera
ID: 39644376
Sorry, now works fine, I think tha we had a typing mistake
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

SSH (Secure Shell) - Tips and Tricks As you all know SSH(Secure Shell) is a network protocol, which we use to access/transfer files securely between two networked devices. SSH was actually designed as a replacement for insecure protocols that sen…
Linux users are sometimes dumbfounded by the severe lack of documentation on a topic. Sometimes, the documentation is copious, but other times, you end up with some obscure "it varies depending on your distribution" over and over when searching for …
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:
Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…

920 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now