Add date stamp to filenames of photos by Sony Xperia camera app

(setopt CSH_NULL_GLOB; cd /path/to/Camera\ Uploads; for i in DSC_* MOV_*; do mv -v $i "$(date +%F -d @$(stat -c '%Y' $i)) $i"; done)
Sony's Xperia camera app creates files without time-stamped names. Thus, after deleting files on the phone, the same names will be reused. When uploading the photos to a cloud storage, this means that files will be overwritten. Running this command after every sync of uploaded photos with the computer prevents this.
Sample Output
'DSC_0075.JPG' -> '2020-04-11 DSC_0075.JPG'
'DSC_0076.JPG' -> '2020-04-11 DSC_0076.JPG'

By: langec
2020-04-12 06:15:07

What Others Think

Thanks for the solution to this command. I have been searching for this from the last few days.
NelsonFAnderson · 10 weeks ago
I have been looking for this command from a few days and didn't find any luck until I landed on this website. I really like this website and it also helps me with my programming assignments that I do with the help I really like their services and would suggest them to anyone who needs writing assistance.
Fiself1944 · 10 weeks ago
The apps and tracking 1-5 devices on an iPhone are simply gorgeous. I can’t imagine having the smartphones of today fifteen years ago as a journalist when I was carting around armloads of equipment to get the spy messages I can get today with a 2019 smartphone. And I would not have such unique powers without the help of and their professionalism.
WalterDeversar · 6 weeks and 4 days ago
the article is soo nice the cloud computing for the port is so good have touch with gbwhatsapp apk
moksha456 · 6 weeks and 3 days ago

What do you think?

Any thoughts on this command? Does it work on your machine? Can you do the same thing with only 14 characters?

You must be signed in to comment.

What's this? is the place to record those command-line gems that you return to again and again. That way others can gain from your CLI wisdom and you from theirs too. All commands can be commented on, discussed and voted up or down.

Share Your Commands

Stay in the loop…

Follow the Tweets.

Every new command is wrapped in a tweet and posted to Twitter. Following the stream is a great way of staying abreast of the latest commands. For the more discerning, there are Twitter accounts for commands that get a minimum of 3 and 10 votes - that way only the great commands get tweeted.


Subscribe to the feeds.

Use your favourite RSS aggregator to stay in touch with the latest commands. There are feeds mirroring the 3 Twitter streams as well as for virtually every other subset (users, tags, functions,…):

Subscribe to the feed for: