Solved

Generate  a filename that include date and time

Posted on 2013-11-13
7
444 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
Comment Utility
import capture$(date +%Y-%m-%d-%H%M).png
0
 

Author Comment

by:lnrivera
Comment Utility
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
Comment Utility
Which shell are you using?
If it doesn't understand $(date +%Y-%m-%d-%H%M), try `date +%Y-%m-%d-%H%M`
0
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 

Author Comment

by:lnrivera
Comment Utility
The standard for Ubuntu, I think that is bash.

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

Expert Comment

by:ozo
Comment Utility
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
Comment Utility
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
Comment Utility
Sorry, now works fine, I think tha we had a typing mistake
0

Featured Post

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

This is the error message I got (CODE) Error caused by incompatible libmp3lame 3.98-2 with ffmpeg I've googled this error message and found out sometimes it attaches this note "can be treated with downgrade libmp3lame to version 3.97 or 3.98" …
Have you ever been frustrated by having to click seven times in order to retrieve a small bit of information from the web, always the same seven clicks, scrolling down and down until you reach your target? When you know the benefits of the command l…
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.:
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

762 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

7 Experts available now in Live!

Get 1:1 Help Now