Renaming time series files

I’ve sometimes come across problems while working with remote sensing data and software, where the data that I’ve downloaded is not readable in the software because its file name contains an unwanted character, such as “-“.  Today I had a time series of 612 GIMMS files that needed to go from data1_15_Apr_1982 to data19820401 (for example). The idea of doing it manually did not appeal to me at all, so I found a program that I’ve been looking for for a long time, the Bulk Rename Utility. You don’t need to be a programmer to use it and it’s free and quite easy to understand (and if you prefer coding I suggest you take a look here). In my case, I had to do it in several steps, maybe because I don’t know how to add more than one of the same type of criteria, but here’s how I did it:

Step 1: Move last 4 to position 5 (this part puts the year after “data”)

Result: data19821_15_Apr_

Step 2: Replace “_Apr_” with “04” (And iterate for each month – this part could maybe be improved)

Result: data19821_1504

Step 3: Replace the following:

“1-15” with “01”

“16-28” with “16”

“16-29” with “16” (leap year)

“16-30” with “16”

“16-31” with “16” (wish all months had the same no of days)

Result: data19820104

Step 4: Move last 2 to position 9

Result: data19820401

It quickly processed the 612 files and doing it in steps helped me make sure that I did it right.

What I need the data files for is a story for another post!

My new friend, the bulk rename utility!


3 thoughts on “Renaming time series files

  1. Pingback: Renaming, converting, clipping: script based time series processing | Sahel studies

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s