Some file managers have a 'bulk rename' plugin, Thunar (standard for 
XFCE desktop) is one

On 02/03/2016 03:05 PM, Paul Heinlein wrote:
> On Wed, 3 Feb 2016, John Jason Jordan wrote:
>
>> I frequently have a dozen or so screenshots taken with VLC. The files
>> are in the format like this:
>>
>> vlcsnap-2016-02-03-14h28m24s290
>>
>> I wish to rename all the files in the folder that start with 'vlcsnap'
>> to <some_keyword>#, where # is an incremental number starting with 0
>> for the first one and incrementing for each one. The files appear in
>> chronological order, and that is how I want them numbered. It is
>> important that they be numbered in chronological order. But once they
>> are renumbered I don't want the cumbersome time stamp on each file. In
>> other words, using the above file as an example, and assuming that it
>> is the first in the series, I want to rename it to to:
>>
>> Keyword0
>>
>> At this time I am renaming them individually one at a time. But I
>> suspect that I can automate the process with the command line, saving
>> myself a lot of tedious work. I could use some suggestions for how to
>> go about this.
> Assuming that bash will list your vlcsnap files in the chronoglogical
> order you desire, this should do the trick. Note that it merely prints
> the mv operations to stdout; it doesn't actually do anything to your
> files. You'll want to make the 'echo' line into a 'mv' command to
> accomplish that. (Or save the output to a file and execute that file.)
>
> let N=0
> for F in vlcsnap-*; do
>     echo "mv $F Keyword${N}"
>     let N=$N+1;
> done
>
> I'm sure you know that, in this recipe, the resulting Keyword* files
> will not sort correctly. For example, Keyword11 will sort before
> Keyword2.
>
> If you want them to sort correctly, you can either let N be a large
> number (let N=100000) at the beginning of the script or use printf to
> add leading zeros:
>
> let N=0
> for F in vlcsnap-*; do
>     echo "mv $F Keyword$(printf '%05d' $N)"
>     let N=$N+1;
> done
>
> Adjust the '5' in that recipe as desired.
>

_______________________________________________
PLUG mailing list
[email protected]
http://lists.pdxlinux.org/mailman/listinfo/plug

Reply via email to