Jump to content

Rename File action


Recommended Posts

Well there was a feature Request for adding "Rename File" to the internal commands on files here: http://www.alfredforum.com/topic/1675-add-a-rename-action-to-the-file-action-list/

David Ferguson quickly replied with an custom workflow (with some smart Alfred magic making Alfred calling search on itself!)

But his version was a bit raw and limited to files only. So I enhanced it as follows:

1. It uses "mv" instead of cp / remove. This way it will work on folders (and bundles).

2. I made it so that the original name is the default when you rename a file.

3. I added Alleyoop update to it as I may enhance / debug in the future.

You can get my "Rename File" workflow version from here: https://github.com/oderwat/alfredworkflows/raw/master/Rename%20File.alfredworkflow

V1.1: Visible rename confimation. Fixed renaming of files with spaces in name. CMD Return on rename now copies the resulting file path to the clipboard. Upgraded Alleyoop code too.

All my current workflows are available here: https://github.com/oderwat/alfredworkflows

Edited by oderwat
Link to comment

Thanks for the workflow, this is the first one I found that actually works (for the most part, see below).

Please note that if you're trying to rename a file with more than one word, you only get the first word as the default "rename-to" filename.


I don't have much time to look at the code and try to fix it unfortunately, but I'm sure you'll push an update fixing this soon enough, shouldn't be a huge bug to fix, considering the renaming works fine, just the preview doesn't "populate" with the default filename properly.

Edited by The_Ben
Link to comment

thanks for the workflow. is there anyway to make the font smaller so that the entire original filename can be displayed in the alfred window?

 

You'd have to change the font size for everything. Alfred Preferences > Appearance > Theme then cmd+shift+click on the text you want to make smaller.

Link to comment

Thanks for the workflow, this is the first one I found that actually works (for the most part, see below).

Please note that if you're trying to rename a file with more than one word, you only get the first word as the default "rename-to" filename.

I don't have much time to look at the code and try to fix it unfortunately, but I'm sure you'll push an update fixing this soon enough, shouldn't be a huge bug to fix, considering the renaming works fine, just the preview doesn't "populate" with the default filename properly.

 

As I have a lot of files with spaces in it, I'm proposing  a fix for this issue, see http://d.pr/f/LY6A

 

@oderwat can you validate my fix and include it in yours ?

 

Hope this helps

 

Cheers

Link to comment

Hey @vdesabou!

 

I modified "my" version of the script to handle the spaces in Names, grabbed that visible message idea and made the clipboard copying optional when you press CMD on rename (I hate to mess up my clipboard as side effect).

 

I did not add your extra script cause I like to have the things "visible" so others can check it out and use part of it.

 

Still not tested very much! I am not sure if all escaping works as expected. There may be still problems with some filenames.

Link to comment

Hey @vdesabou!

 

I modified "my" version of the script to handle the spaces in Names, grabbed that visible message idea and made the clipboard copying optional when you press CMD on rename (I hate to mess up my clipboard as side effect).

 

I did not add your extra script cause I like to have the things "visible" so others can check it out and use part of it.

 

Still not tested very much! I am not sure if all escaping works as expected. There may be still problems with some filenames.

 

Yeah no worries, I forgot I added that on my side :-)

Cheers

Link to comment
  • 1 year later...
  • 1 year later...
  • 2 years later...
  • 3 months later...
On 6/23/2019 at 3:40 AM, snowfox said:

Update for Alfred 4

 

Change that to:

 

tell application id “com.runningwithcrayons.Alfred” to search “to: {query}”

 

That should work with v4 and every future version of Alfred, so it won’t need updating for Alfred 5 and later.

Edited by deanishe
Link to comment
On 6/26/2019 at 4:13 PM, proxemics said:

Would there be an easy way to have this hide the file extension?

 

Without meaning to hijack the thread, but I’m assuming this Workflow is not well maintained, as evidenced by the last update dates in the repo and users having to post the required fixes in text.


I have a Workflow that does the same thing. I have no idea if it works the same to this one interface-wise — until now I didn’t even know this one existed. But some of you may want to try it as it’s well-maintained (and will continue to be for the foreseeable future), and particularly you @proxemics, as it hides the extension when asking for the new name.

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