Jump to content

Rename Action — Rename files and folders


Recommended Posts

42 minutes ago, deanishe said:

Sounds like the real problem is that it works top-down instead of bottom-up.


Tried that but the result was the same. Also tried making a loop to rename one result at a time and thought about changing directories before doing the rename. But by that point I would already be losing any benefit of using an external program instead of doing it myself and falling again into the trap of having to test every case.

Link to comment
2 hours ago, vitor said:

Also tried making a loop to rename one result at a time and thought about changing directories before doing the rename.

 

IIRC, the way to do it is to recursively collect all the filepaths, sort them (this puts every parent before its children), then process them in reverse order. But yeah, that won't work if your rename program is altering more than the last path component.

Edited by deanishe
Link to comment
  • vitor changed the title to RenameAction — Rename files and folders

Update.


Rewrote the Workflow in JXA and added quality of life improvements. Now you’ll get feedback when typing the new name, and if the desired target already exists it won’t let you proceed (previously it appended the date to the name).


To update, download the latest version (same URL) or wait a few days and it’ll prompt you to on next usage, since it uses OneUpdater.

Link to comment
  • vitor changed the title to Rename Action — Rename files and folders
  • 2 weeks later...
  • 2 months later...
  • 5 months later...
  • 2 months later...

Hi, Vitor.

Sorry for being not so clear. Some posts above, you mention "Now you’ll get feedback when typing the new name,". So, I thought the workflow would suggest names, based in some rules.

For example: 

1. original filename: 'some name for this file.pdf'

2. when using your workflow, it could suggest some different names:
- 'Some Name for This file.pdf'

- 'SOME NAME FOR THIS FILE.PDF'

- 'some-name-for-this-file'

 

Thanks!

Fabio

P.S.: How about allowing the use of another workflow to make these transformations an 'input' for your workflow?

Link to comment
  • 1 month later...

I just want to echo my thanks for this action. Very useful and odd that it was not in Alfred itself. Thank you. 

 

I feel that the way I use it is inefficient, maybe I am not understanding how Universal Action works in general:

1. I search for a file name in Alfred. Alfred gave me 5 results. I want to rename all 5 files.

2. I highlight the first file and tap Ctrl twice. This opens up Universal Action and I choose rename. Changed the filename and press Enter. 

3. File is change, Alfred disappear. Now I have to Cmd Space and invoke Alfred and start steam 1 all over again.

 

Is there a better way to do this i.e. rename, then go back to the list of 5 results and move on to the next file to rename?

 

Link to comment

Re: File Buffer:

1. I don't want to rename 5 files under same name. File Buffer seems to be performing the same action on all 5 files in the Buffer

2. If I do an Alt - right arrow to action on these files, I can't see the Rename workflow (I only see it when I double tap Ctrl). I think this is probably something I might have turned off years ago..

Link to comment

Thank you for the kind words.
 

You can only rename one file at a time. Renaming multiple is a complex action usually involving some kind of sequencing, and renaming multiple to entirely different things even more so. I’ve never seen a way to do it that I found ideal, neither in GUIs nor in CLIs (and I wrote some, too). The ones that get close still require understanding the rules beforehand. It would also be incompatible with the feature to reopen the Universal Actions panel after renaming, which I find immensely more valuable and have a need for significantly more often. I don’t intend to add the feature unless the solution is so good and clear to regular users that it’s worth a rewrite of the workflow (which likely would need to happen).

Link to comment
8 minutes ago, vitor said:

It would also be incompatible with the feature to reopen the Universal Actions panel after renaming, which I find immensely more valuable and have a need for significantly more often.

This would be extremely useful but if it's not how Universal Actions panel is intended, then I guess we have to make do. How about returning back to search after the renaming? That way, the user can arrow key down to the next file for renaming.

Link to comment

It can’t return back to search because it doesn’t know you got there through search. You could’ve selected files in the Finder, or used a custom File Filter, or Script Filter, or gone through the navigation pane, or any other combination.

 

This workflow is meant to be flexible and work from any place. What you’re asking for is specific to your usage so you’d need to make a workflow which behaves that way.

Link to comment

Hmm, that’s right. I’ve forgotten that I could trigger Universal Action from a Finder window. Thanks for the workflow. It works for what it is made for and I’m thankful. Saves lots of time especially with the files being every where. 

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...