Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I've created a folder in dropbox for all my screenshots, and redirected all my screenshots there.

However the default screenshots file name are long (it contains a time stamp and I don't see how to remove that). I'm wondering if I can use some shell script or applescript to do this.

Also I need it only change the names of newly added files. I've tried automator, but it keep renaming all files in that folder. E.g. 01.png may become 03.png after adding other files to that folder, which make correct dropbox reference literally impossible.

share|improve this question
    
Can you give us an example of the file names? (With the date in the name)? –  Hennes Jul 26 '12 at 17:56
    
In principle you can do this using Folder Actions and AppleScript, but those don't work reliably if there are several files changed in quick succession. –  Daniel Beck Jul 26 '12 at 17:57
    
@Hennes e.g. "Screenshot 2012-07-26 上午10.40.25" It contains Chinese character. –  hyh Jul 26 '12 at 18:33
    
I can't seem to figure it out. I was toying with something like this from a shell for a in * ; do echo -n "Moving" $a "to " ; (echo $a | cut -c1-10,25-26,28-29,31-32) ; done (Obviously a literal cut and paste just echos text rather than execute a mv) –  Hennes Jul 26 '12 at 20:01

2 Answers 2

Here's a simple bash script you can use:

#!/bin/bash

#
# Rename a folder of images using a prefix in a numbered sequence
#
# @author Henry Tseng
# Jul 27, 2012
#

# Retrieve 
if [ ! -d "$1" ]
then
    echo "rename_files: \"$1\" is not a directory"
    exit
fi

# Rename set
echo "Renaming"

FILES="$1*"
N=0

for f in $FILES
do
    N=`expr $N + 1`
    echo " $f"
    RCMD="mv '$f' $1img_$N.jpg" 
    eval $RCMD
done
share|improve this answer

You can do this using the commercial Hazel tool.

Just create a rule that looks like the following:

Screenshot of applicable rule

The result will look like this, with numbers appended due to rename automatically selected in Options:

Folder containing sequentially named image files

share|improve this answer
    
Great! Is it possible to do it using Quicksilver? –  hyh Jul 26 '12 at 18:35
    
@hyh Hazel and Quicksilver are fundamentally different tools. That's like asking how to do something in Firefox when the answer talks about Microsoft Word. Just download Hazel and see for yourself how it works. –  Daniel Beck Jul 26 '12 at 18:47
    
so Hazel is an app just for organizing folders? Then $25 seems expensive. I'd like to find some hack to do this by myself. –  hyh Jul 27 '12 at 1:46

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.