Jump to content
oderwat

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

Share this post


Link to post

Thanks, great workflow, I use it a lot!

 

I've just added on my side a Notification at the end and a Copy to clipboard with the new file name in order to quickly browse it in Alfred if I need to

Share this post


Link to post

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

Share this post


Link to post

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.

Share this post


Link to post

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

Share this post


Link to post

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.

Share this post


Link to post

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

Share this post


Link to post

 

tell application "Alfred 3" to search "to: {query}"

Modification required to work with Alfred 3

 

 

Thanks!

Share this post


Link to post

Would there be an easy way to have this hide the file extension? I'm only ever really renaming the file itself, and would be a bit easier if it did not show the file extension, but just the file name...

 

Thanks for the great workflow!

Share this post


Link to post
Posted (edited)
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

Share this post


Link to post
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.

Share this post


Link to post

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...