I grew up with The Sims and remember spending what is probably hundreds of hours of my childhood with that game, so it was a special feeling to share that with my wife and introduce her to The Sims 3 a few years ago.

Coming from Animal Crossing: Happy Home Designer, the expanded toolset for interior design (AND addition of architecture tools) hooked her, but she wasn't that into the non-building part of playing The Sims. It actually wasn't until last year when we got The Sims 4 (TS4) at a discount that she got into the full Sims experience, because TS4 is waaaaaaay better in every way (from building houses, to playing with your sims).

We would build and show off houses for each others’ households, tell each other stories of what our sims have been up to, snuggle on the couch and watch speed builds from YouTubers like MsGriphy and SimLicy, and eventually we came across what is known as The 100 Baby Challenge. Like many in The Sims community who have undertaken this months-long challenge, she has been cataloguing her journey on Instagram.

I helped her figure out a workflow for doing this, which starts with taking screenshots in-game and uses Google Drive to make them available for uploading on her phone. Unfortunately, the naming system that TS4 uses when saving screenshots is not helpful for browsing the screenshots on Google Drive to pick which ones she actually wants to post on Instagram. For example: 07-31-20_1-02-45 PM.png for a screenshot taken at 2020-07-31 13:02:45.

This mostly messes up the order of the screenshots that were taken on the same day in the morning and in the afternoon, but also in situations where you have screenshots from 1AM, 2AM, 11AM since the order would be 1AM, 11AM, 2AM due to lack of leading zeros.

My solution for this was to make an executable R script. Thanks to Peter Meissner's post on Making R Files Executable (under Windows), I was able to turn the following R code into a Rename Screenshots.Rexec executable that she could run by double-clicking, which would then check if there are any screenshots that need to be renamed and rename them to a format that's more like ISO 8601:

setwd(r'(C:\Users\Mikhail\Google Drive\Sims 4)')

old_names <- dir(pattern = r'(([0-9]{2}-?){3}_([0-9]{1,2}-?){3}\s[AP]M\.png)')

if (length(old_names) > 0) {
  message("Found ", length(old_names), " screenshots to rename, renaming...")
  sans_ext <- sub(".png", "", old_names)
  datetimes <- lubridate::parse_date_time(sans_ext, orders = "m-d-y_I-M-S p")
  new_names <- format(datetimes, "%F %H-%M-%S.png")
  message("Example of a rename:\nOld: ", old_names[1], "\nNew: ", new_names[1])
  file.rename(from = old_names, to = new_names)
} else {
  message("No screenshots to rename, exiting...")

I used:

Hope yinz are staying safe and healthy.

P.S. The Sims Spark’d season 1 is not bad so far.