GNU/Linux Tips: Thunar's Secret Weapon!
If you use a desktop environment then there's a lot of reasons to like the Thunar file manager. Especially so, for example, if you're tired of Nautilus trying to be Windows Explorer, crashing at the worst times, like while you're transferring files over sFTP, or just generally devouring your system's memory (e.g. tracker & tracker miners run even if you use Nautilus without the Gnome DE). But I digress.
The real purpose of this post isn't to vent my frustrations with Nautilus, it is to shed some extra light on a feature of Thunar that often goes unmentioned and unnoticed - the bulk renamer
. It's no secret, really, but it isn't specifically mentioned in the Edit or right-click menus, where you only find the regular 'Rename...' option. In fact, I don't see it mentioned, or even hinted at, anywhere in the app, despite the great utility this little tool possesses!
So how do we access this bulk renamer? Does it even exist, or am I just toying with you here? So many questions... Well, the Thunar developers are actually quite ingenious; the bulk renamer is context-activated! Whenever you select multiple items, and then choose that regular old 'Rename...' function - poof - there it is!
Isn't that nifty? It can even support regular expressions, as well as several other functions aside from your standard 'Search & Replace'. For example, the bulk renamer can pull tags from your music files, making it easy to fix those CD rips that end up all named 'Track_01.mp3', and so on, and give them a meaningful name based on something like the track number and song title. Likewise, you can add timestamps to filenames from various meta-data sources such as last access
, last modified
, or even get the time a photo was taken
using it's meta-data! I could go on and on, but it's just a great bulk rename utility! Especially so, given that it's already
built in to the file-manager many of us use.
But maybe you don't
use Thunar, or for whatever reason you would just rather just have a stand-alone bulk rename utility... Well, remember when I mentioned how ingenious the Thunar devs are? They got you covered here as well! If we run thunar --help
we get the following:
-h, --help Show help options
--help-all Show all help options
--help-gapplication Show GApplication options
--help-gtk Show GTK+ Options
-B, --bulk-rename Open the bulk rename dialog
--daemon Run in daemon mode
-q, --quit Quit a running Thunar instance
-V, --version Print version information and exit
--display=DISPLAY X display to use
Ah ha! So you can run Thunar with that -B
switch and it will open the bulk renamer in stand-alone mode
, and not even display the Thunar file-manager!
On my system (Arch Linux) there's already an application launcher to run the bulk renamer this way If you have Thunar installed. I imagine this is pretty standard, so you should see it on your system as well and it goes by the unassuming title of 'Bulk Rename'. Personally, I use i3 window manager and simply added a line in the config to allow me to easily run exec /usr/bin/thunar -B
at the press of a key (...board shortcut). And of course similar functionality can be achieved in most window managers, for those who prefer keyboard shortcuts over excessive mousing around :P
Now, I know a lot of you probably use the terminal, and solve these issues by piping various commands and such... Which is admittedly pretty powerful, and a bad ass way of working! I too prefer the terminal for many tasks and always at least four tiled terminals open at any given time. However, I do find it more convenient to do certain tasks with a GUI, and I love that the Thunar bulk renamer allows me to quickly and easily preview the file names, and make changes as needed in real time.
This may have been totally obvious to many of you, but I had been using Thunar for a couple of years before I discovered the bulk rename functionality some time back! I hope this tip helps others, who may also be oblivious to this little (simi-) hidden gem!Happy file organizing!