LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 04-26-2005, 10:07 PM   #1
toaster.waffle
Member
 
Registered: Feb 2005
Location: Ontario, Canada
Posts: 97

Rep: Reputation: 15
adding date to filename (creating a quick screenshot button)


hey! as the subject suggests, i'm trying to make a screenshot button for my XFCE toolbar.

I make a launcher and add the lines:

import -window root /home/user/quick.png

It works great! But, I want to add the current time and date for three reasons:

1) organization
2) it doesn't overwrite the old "quick.png"
3) .. well organization i guess.

Can anyone help me? The only other thread i've found explains:

DATE=`date '+[add format here]'`... or something. I've tried that and then following it with:

ls > txt_$DATE.txt

but not as a launcher.


The DATE=.. thing doesn't work with a launcher.. it has an error saying file not found... but it seems to work in the console. I know i'm probably using more energy asking; but oh well

Can someone tell me how to add Date and/or time to my filenames while using import?
 
Old 04-27-2005, 12:33 AM   #2
ahwkong
Member
 
Registered: Aug 2004
Location: Australia
Distribution: Fedora
Posts: 282

Rep: Reputation: 30
you would need to do some scripting...


put something like these

Code:
#!/bin/bash
d=`date +%Y%M%d`
import -window root /home/user/quick.$d.png
in a file says wincapture.sh

then run this script in your launcher ...

(the script is not tested)
 
Old 04-27-2005, 03:19 AM   #3
elluva
Member
 
Registered: Aug 2003
Location: Belguim, Ostend and Ghent
Distribution: Ubuntu
Posts: 600

Rep: Reputation: 30
indeed this is the way to do it, just dont forget to set the permission flags of the script to executable. If you dump it somewhere in your $PATH, e.g. /usr/local/bin, you can just call it by 'wincapture.sh' from anywhere anytime.

grtz,
elluva
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
logrotate with date in filename ptp Linux - Newbie 1 04-14-2011 10:55 AM
adding date timestamp to filename markraem Solaris / OpenSolaris 2 11-17-2004 08:32 AM
use date as output filename? wijnands Linux - Newbie 1 05-12-2004 03:39 PM
Creating a date-based filename for a tarball? HomeBrewer Linux - Newbie 4 12-20-2003 02:16 PM
how to add date to filename x2000koh Programming 1 07-08-2003 09:44 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 10:30 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration