[SOLVED] Renaming files in order of date

Questions about applications and software
Forum rules
Before you post please read how to get help
Post Reply
DeMus
Level 6
Level 6
Posts: 1029
Joined: Sat Aug 15, 2009 5:11 pm

[SOLVED] Renaming files in order of date

Post by DeMus » Wed Oct 29, 2014 12:12 pm

Hi,

I just received a bunch of pictures of my first grand-child and I want to place all of them on a Facebook page for the whole family to see.
Problem is the pictures have the strangest names, coming from different camera's: img0001, 200608081246, etc.
I want to have them in order of date, okay I can do that in Dolphin (KDE filemanager) but I also want to have them in order of date on Facebook. Yes, I know, Facebook changes the names again, but as far as I know, the order is not changed because of that.

How do I do that? What is the correct syntax which I have to type into a terminal?

Thanks all for your help.

I just noticed the dates are not always correct, since I see dates when the pictures were copied, not when they were taken.
When possible, I would like to see the pictures in order of the EXIF dates in the jpg files. Is that possible? Is it possible to read that info and use it to rename the file? I really have no idea. Who does know it, who can help me?
Last edited by DeMus on Wed Oct 29, 2014 1:09 pm, edited 1 time in total.

C-TZ
Level 1
Level 1
Posts: 6
Joined: Wed Nov 13, 2013 4:20 am

Re: Renaming files in order of date

Post by C-TZ » Wed Oct 29, 2014 12:35 pm

Hi DeMus,

I'm not sure about what exactly you want... You can use facebook through terminal using this cool tool called facebook_client_terminal written by Kissrobber:

https://github.com/kissrobber/facebook_client_terminal

Possible answers you might like to use bash to rename filenames to include the date is:

Code: Select all

DATE=$(date +%Y%m%d)
mv "$FILENAME" "$FILENAME"_$DATE.txt
from: http://www.linuxquestions.org/questions ... pt-906507/

or somewhat more advanced, to use it on several files:

Code: Select all

cdate=$(date +"%Y-%m-%d")
shopt -s extglob
for file in !([0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]*.gz); do
  mv "$file" "${cdate}_$file"
done
from: http://unix.stackexchange.com/questions ... -the-files

You can change *.gz to *.jpg or *.png, depending on the filetype.
Put that in a bash script (script.sh for ex.), modify it with chmod +x and run it with ./[scriptfile].sh

Hope this helps

User avatar
richyrich
Level 19
Level 19
Posts: 9075
Joined: Mon May 04, 2009 8:31 pm

Re: Renaming files in order of date

Post by richyrich » Wed Oct 29, 2014 12:42 pm

Have you tried krename? It's in Synaptic Package Manager.

DeMus
Level 6
Level 6
Posts: 1029
Joined: Sat Aug 15, 2009 5:11 pm

Re: Renaming files in order of date

Post by DeMus » Wed Oct 29, 2014 12:54 pm

richyrich wrote:Have you tried krename? It's in Synaptic Package Manager.
No, no idea it existed. Installing right now. Hope it works. Will let you know.

DeMus
Level 6
Level 6
Posts: 1029
Joined: Sat Aug 15, 2009 5:11 pm

Re: Renaming files in order of date

Post by DeMus » Wed Oct 29, 2014 1:09 pm

Sorry C-TZ, I couldn't do it with the scripts you wrote. Somehow it doesn't work and I don't know how to change this since I am a complete noob in scripting languages.

Richyrich, the program you mentioned is super. This is what I need. Now I can rename the files just the way I want to rename.
Thank you very much for the great tip.

Post Reply

Return to “Software & Applications”