Jump to content

BulkRename - bulk rename your files, with built-in and custom presets


Recommended Posts

Here is a workflow for bulk renaming files.

 

rename.png

 

You select some files either in Alfred using the File Navigator or the File Buffer and use the File Action called "Rename with BulkRename", or select the files in Finder and use the hotkey to trigger the workflow for the selected files.

 

Once triggered, Alfred will display a preview option and a bunch of preset actions that you can select. The preview option will display the modifications that will be made for each preset action listed.

 

Preview

 

Here are a couple of snapshot portions of what you see when pressing the Shift key:

 

preview1.png

 

 

preview2.png

 

preview3.png

 

Issues are highlighted so that you know if running a preset will work or not. Even if you run that preset, nothing will happen.

 

 

Preset Actions

 

There are 6 actions included as a sample, but you can easily create your own actions using the .list keyword.

list.png

 

To create a new preset, type in .list <new name>. Delete a preset using Cmd+Enter

 

Each preset is nothing but a collection of simple steps that help make the preset action possible. For e.g. when you select the Append Sequence Number preset, you will be shown the preset editor:

preset.png

What the above tell is that the Append Sequence Number preset is a collection of two steps:

 

  • add text '_seq' at end
  • add number from 0, at end

There are added to the preset using any of the steps [+] listed.

You can add any number of steps to a preset, even the same ones over and over.

You can delete an added step using Cmd+Enter

 

node.png

When you add a new step to a preset, or edit an existing step by selecting it, you will be shown the Step Node Editor as above. The above is the example for the "Number Sequence" step, and for this step you can control what the starting number is, where the number should be added, and the format (leading zeros to be added). Items with a arrow -> are variables that you can change by pressing the Tab key. To add the step, just select the first option, and that step will be added to the Preset that you were viewing before.

 

Steps

Steps are the building blocks of each preset, and currently BulkRename has the following:

  • Find and replace: find text and replace with another, supports regex and plaintext, case sensitive and insensitive
  • Add text: add some text at the beginning or end of the filename
  • Add timestamp: add a timestamp at the beginning or end of the filename. Timestamp is one of current time, file created or modified time. YYYY,YY,MM,DD,hh,mm,ss can appear in the format string
  • Convert case: switch the case of the filename to lower, upper, or title
  • Strip text: remove x characters from the filename either at the start of end
  • Number sequence: append a running number sequence, starting from a value that you can specify
  • MP3 Tagger (beta): Extract MP3 tags from MP3 files
  • Regex group extractor: Regex group pattern extractor
  • Change Extension: Allows you to change the extension of a file

 

Keywords

  • The main keyword is .rename (but you would not have to type that in if you use the File Action or the Hotkey)
  • The second one to manage all your presets is .list.
  • .preset and .node are keywords used by the workflow directly, and there is usually no need for you to type those in directly.

Download

 

Notes

  • This works with Python 2.7.2 last I checked

 

Have a look at the included sample presets using the .list keyword to get a hang of how presets are made, and then create your custom ones  :)

Edited by Benzi
Link to comment

Included two new preset steps that you can use to create presets:

 

  • MP3 Tagger (beta): Extract MP3 tags from MP3 files. Supported tags are #artist, #album, #title and #track
  • Regex group extractor: Regex group pattern extractor. You can extract parts of the file name using regex and then use those groups in any way you want. e.g. if your file name is 'this is a test.txt' and you want to move the last word to the first, use the command: (.*) (.*)//$2 $1. The first group matches everything uptil the last space, and the second group matches the last word. The replacement $2 $1 means the last group should come first followed by a space and then the first group.

 

Here are some examples you can download to your custom preset folder to try out:

 

Your custom presets are saved in the following location:

 

~/Library/Application Support/Alfred 2/Workflow Data/com.benzi.a2w.bulkrename/user_presets

 

Download the latest version here.

Edited by Benzi
Link to comment
  • 1 year later...
  • 4 months later...
  • 2 years later...

Very helpful workflow, but when using in Alfred 3, I get this error when trying to edit the preset with the .node and the .preset keywords:

 

Starting debug for 'Files Rename Bulk'

[2016-12-13 11:23:46][STDERR: input.scriptfilter] 31:39: syntax error: A “"” can’t go after this identifier. (-2740)

 

 

 

 

Edited by politicus
Link to comment
  • 4 months later...
23 hours ago, willbraden said:

Is there a working link for this somewhere?

 

Not at the moment. This workflow is no longer maintained / available. (I might have another go at a enhanced version, later, if time permits...)

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...