Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

Gnome-screenshot 3.1.2 uses filenames like this one

Screenshot at 2011-07-31 12:13:04.png

making it rather easy to see when it was taken.

The problem is that it uses the colon ( : ) character - making it impossible to access such an image from Windows.

Considering I take most of my screenshots so I can send them to Windows users this has caused some problems.

Is there any way to change the default name that is used by the screenshot tool to replace the ":" with "." or "," ?

share|improve this question
add comment

4 Answers

It is not actually possible change it easily, maybe you can help with this bug report.

(for the curious, check the source code. Currently, relevant line is 134)

share|improve this answer
1  
+1 for linking to source code. Now THAT is the linux way. (Although the file name code is actually here, now: git.gnome.org/browse/gnome-utils/tree/gnome-screenshot/…) –  mehaase Jul 16 '12 at 19:35
1  
Unfortunately, the link is dead: No repositories found –  gertvdijk Feb 4 '13 at 16:37
1  
New URL: git.gnome.org/browse/gnome-screenshot/tree/src/… (retrieved at 2013-02-16 18:08 UTC+0800) –  LiuYan 刘研 Feb 16 '13 at 10:08
    
I wish we could tweak this locally before good old GNOME developers wake up a little quicker to such important problems reported by users ;-) –  Sadi Jan 18 at 13:49
add comment

There is a simple and dirty way to rename all the screenshot taken immediately after the creation, but you will need to install inotify-tools ( apt-get install inotify-tools ) and then you could run this command:

while true; do inotifywait -e CREATE ~/Pictures && rename 's/\:/\./g' Pictures/Screenshot*.png; done;

While this command will run, everytime you save a new screenshot in Desktop/, the script will rename every file containing :, substituting : with .

(Maybe you want change the directory, I don't know wich directory use Gnome 3) If you really like it, you can start this command in a script every time gnome starts.

share|improve this answer
3  
+1 This is a neat little trick, but your regex should be 's/\:/\./g' –  mehaase Jul 16 '12 at 19:46
    
another option of replacement: use the unicode character –  LiuYan 刘研 Feb 16 '13 at 10:35
    
Note that screenshots are saved by default in ~/Pictures, not ~/Desktop. –  MestreLion Apr 4 '13 at 3:44
add comment

Instead of installing additional software and writing this code in the screenshot tool, here's a workaround to rename the files afterwards.

All you need to do is to navigate to the directory and run the following command

rename 's/\:/\-/g' *.png

This will replace all colons with dashes in all file names ending in .png of the ones present in the current directory.

share|improve this answer
    
Less optimal, but much easier workaround than proposed by fain182. +1 –  gertvdijk Feb 4 '13 at 16:36
add comment

Shutter is another application for taking screenshots which allows you to customize the file name: you can install it from Ubuntu Software Center.

share|improve this answer
    
Shutter is amazing by itself, and this is imho this is the best approach: instead of fixing bad filenames, do not produce them! –  MestreLion Apr 4 '13 at 3:21
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.