Possible Duplicate:
How can I do a mass file rename in Windows?

Scenario: I work with a journalist friend who writes and photographs for travel and art subjects. He uses his Facebook profile to post the photographs.

We are developing his content on other platforms to attract a larger audience: flickr and his own website.

To help him minimise uploading pictures on all platforms I download the photos from his Facebook and republish them on the other platforms.

However, the Filenames given by Facebook are a long underscore separated string of numbers, e.g.: 297978_10150935169935366_674695365_21667071_49502726_n.jpg

This is not very attractive and will appear as the title in flickr.

Manually renaming of each file in the album is a big repetitive task.

I've answered my own question (see superuser.com answer below) as a means to help others as I already knew the solution.

(Solution also posted on PFrank forums here: http://pfrank.s4.bizhat.com/viewtopic.php?p=971&mforum=pfrank#971 )

Alternative approaches very welcome

Please post here!

  • Agreed, the earlier question cited (superuser.com/questions/303107/… ) would provide the reader with the basis to solving this problem. However I disagree with the closure as I believe my question/answer adds value getting the reader there faster with exact automation steps for renaming facebook filenames with the free pfrank tool.It's a more specific problem than the duplicate cited.Perhaps also my question even enlightens people about how to more easily repurpose their content from Facebook. BTW I don't have any involvement with PFrank. Jan 2 '12 at 12:26

PFrank to the rescue.

PFrank is probably the most powerful and flexible automated Windows GUI batch renamer on Windows.

And it's free!




(Images are auto-scaled - use your browser menu options to view full size in the proper resolution).

Put the files into a folder named as the gallery - this name will be reused in the filenames along with a counter to make each file unique

1) Here's the list of files:

01 facebook filenames.png

2) Here are the PFrank renamer settings:

02 pfrank renamer settings.png

In plain text these are the following in the List:

Line 1: Search pattern: ([0-9]+)([0-9]+)([0-9]+)([0-9]+)([0-9]+)_n.jpg Replace pattern:

Line 2: Search pattern:

Replace pattern: Insert Folder beforePrefix*

Line 3: Search pattern:

Replace pattern: Insert Counter afterAll*

Line 4: Search pattern: (.*)

Replace pattern: 1.jpg


List step #1 removes the facebook filename List step #2 puts the containing folder/directory name into the filename List step #3 appends the counter to make the file unique List step #4 appends the .jpg extension

  • you'll see some of the Search pattern: and Replace pattern: are empty - this is deliberate so leave blank
  • In Menu Option View->Options you can set the delimiter as underscores _ or something else and counter increment ascending/descending to suit your requirement

3) Preview how PFrank has renamed the files:

03 rename preview.png

4) You may want to log the original filenames from facebook and how they "map" to the new names - for traceability/audit reasons. Pfrank provides for the ability to select all the files in the preview, then using CTRL-C you can copy the list to the clipboard and paste it into a text editor.

But you may want to hide some of the other columns first:

04 begin removing columns from rename preview.png

5) Just the old filename (from Facebook) and new Filename here:

05 oldname newname only.png

6) In the Pfrank rename preview window select all the files so they are highlighted (do this e.g. by left click on the top then hold down SHIFT and click the last, bottom file to select all). Then CTRL-C the files in PFrank Renamer, CTRL-V into a text editor

06 ctrl-c selected on rename preview then ctrl-v into editor.png

7) Click rename in the PFrank renamer window and yes to the bulk rename warning.

Resultant files:

07 renamed files.png

Another, even better option, is to add facebook app functionality to external site that the photos are intended for. This is possible if the site is Drupal-based (using the http://www.drupalforfacebook.org/ suite of modules ). This could provide automation, and also export the captions.

But in the meantime there is PFrank for the renaming.

Not the answer you're looking for? Browse other questions tagged or ask your own question.