Jump to content
vitor

RenameAction — Renames a directory or file (preserving the extension)

Recommended Posts

File action to rename the selected directory or file (preserving the extension).

 

Use Alfred to pick what you want to rename and choose Rename as the action. Alfred’s main window will appear and you type a new name (don’t include the file extension).

 

301Njow.png

 

Download | Source

Edited by vitor

Share this post


Link to post

Very nice!  Odd that this wasn't built in in the first place.  :)

 

One thing: because of the implementation, the keyword "rename to:" now shows up if I'm searching for a keyword or app that starts with "re", which is distracting.  ("restart," "adobe reader", etc.)  Also, it doesn't seem like that keyword does anything if called directly—does it?

 

I'm not sure how to implement it in applescript, but I think it would be cleaner if there weren't the extra keyword in Alfred.

Share this post


Link to post

Very nice!  Odd that this wasn't built in in the first place.   :)

 

Agreed. There’s already a feature request for it.

 

One thing: because of the implementation, the keyword "rename to:" now shows up if I'm searching for a keyword or app that starts with "re", which is distracting. ("restart," "adobe reader", etc.) Also, it doesn't seem like that keyword does anything if called directly—does it?

It does not do anything if called on its own, no, and I agree it can be somewhat distracting.

 

I'm not sure how to implement it in applescript, but I think it would be cleaner if there weren't the extra keyword in Alfred.

Applescript is not relevant for this, but I absolutely agree, it would be cleaner if there was a way to do this in one go, but unfortunately there is not.

It’s not the first workflow where I was forced to use this technique (see LabelColor and RunCommand), and I really dislike doing it this way, it is done due to Alfred’s limitations, as there is currently no other way to chain file actions to get further input.

What you can do is change the name to something you wouldn’t usually start a search with, like “%rename to:” — that way you won’t see it as much, if ever, and it has the same result (you also need to change the code in the top right node, to reflect this).

Share this post


Link to post

This is great! (I also really like your LabelColor workflow.)

 

Is there a way to have the current filename pasted in and selected, ready to either tweak or overwrite? I find that when I rename files it's mostly to make small changes to long filenames so having this as a feature would be a big help.

 

Thanks again for the great workflow!

Share this post


Link to post

This is great! (I also really like your LabelColor workflow.)

 

Is there a way to have the current filename pasted in and selected, ready to either tweak or overwrite? I find that when I rename files it's mostly to make small changes to long filenames so having this as a feature would be a big help.

 

Thanks again for the great workflow!

Thank you for the kind words.

Yes, it is possible, although it’s a bit of a hack. Not sure how I feel about it yet, so we can try and see. Simply download the workflow again, it’s now working like you asked.

Share this post


Link to post

Thank you for the kind words.

Yes, it is possible, although it’s a bit of a hack. Not sure how I feel about it yet, so we can try and see. Simply download the workflow again, it’s now working like you asked.

 

Awesome! Thank you! 

 

Unless it causes problems, I hope you keep it. It doesn't cost any extra time (you need no extra keystrokes to type in a completely different name), but it saves so much time if you just want to, say, change a number at the end of a long file name. :)

 

Thanks again!

 

Alex

Share this post


Link to post

Unless it causes problems, I hope you keep it. It doesn't cost any extra time (you need no extra keystrokes to type in a completely different name), but it saves so much time if you just want to, say, change a number at the end of a long file name.

I agree, I’m only ambivalent because it’s kind of a hack (I have to tell System Events to press certain keystrokes to select the text (since Alfred does not support that option) and although it’s unlikely someone will have those keyboard shortcuts set to something else, it is possible. It’s may also be less clear if you don’t see the “rename to: ” text (due to a long filename), that you’re supposed to write the filename there.

Either way, it’s on github, so even if I change my mind later, you should be always able to get this version, with this behaviour.

Share this post


Link to post

Walk me through the process of what you’re doing. Be as specific as you can (name of the file, how you select it, how you call the action, what appears in Alfred, what new name you’re inputting, everything you can think of). If you can make a video, that would make it ideal.

Share this post


Link to post

Easy enough to solve. The problem is that you’re not supposed to type the command. This is to be used as a file action, which means you select the file, then press the file action hotkey (I think the default is ⌘+⌥+\), and select “Rename”. Alfred’s window will appear, and there’s where you’ll type the new name (the old one will be selected, in case you just want to perform a small change).

Share this post


Link to post

Ah ok....I feel stupid

I didn't understand it was a file action.

 

Do you think is there a way to rename like I do in the video?

I think it will be easier cause I don't use so much the Alfred navigation.

Share this post


Link to post

You don’t need to use Alfred’s navigation; as stated, you can select the file and press the file action hotkey. That said, yes, it’s very easy to add a way to rename like you ask, but why would you want to? If you have the file already selected in Finder, simply pressing ↩ will allow you to rename it.

Share this post


Link to post

 

 

That said, yes, it’s very easy to add a way to rename like you ask, but why would you want to? If you have the file already selected in Finder, simply pressing ↩ will allow you to rename it.

I understand what you mean

 

but I'd love to select my file in the finder, press an hotkey like cmd+alt+R for example and then in the Alfred window I'll rename the file

cause I can see the words better and bigger and I'll prefer also if there is not the name of the old file.

 

With this configuration I have to:

1) select the file in the finder

2) press the hotkey for the action

3) delete in the Alfred window the word is already written

4) rename to the new file name

 

Instead I'll love to:

1) select the file in the finder

2) press cmd+alt+R

3) rename to the new file name 

 

I know It sounds crazy.

Any chance to do that

 

Many thanks for the help

Share this post


Link to post

You don’t have to explicitly delete the name. That’s why it’s already selected, so you can start typing the new name right away.
 
Go here to get a version that works how you want (you’ll have to set up the keyboard shortcut yourself, since Alfred does not keep that when opening workflows). The link will be available for a few days.

Share this post


Link to post

many thanks

you're great

 

 

You don’t have to explicitly delete the name. That’s why it’s already selected, so you can start typing the new name right away.
 

 

I don't understand this:

the name of the file is not already selected, I send you 2 video examples:

 

http://dl.getdropbox.com/u/23761381/IMG_3178.MOV

 

http://dl.getdropbox.com/u/23761381/IMG_3179.MOV

 

Am I missing something?

Share this post


Link to post

If you see the earlier conversations on this post, you’ll see I describe the feature of selecting the old file name as a hack, that could break under certain conditions. It looks like you might meet those, so here’s a version that will work for you, without presenting the old file name. I hope it suffices for your needs.

Share this post


Link to post

It is not working for me. Anyone else has this problem? 

 

When making a bug report/asking for help, you need to be more specific. No one will be able to help you without context to figure out what is wrong.

 

Are you on Alfred 3? If yes, download the latest version again from Packal. That might’ve been your issue.

Share this post


Link to post

Thanks Vitor! Haven't seen the updated version on Packal. It is working now. Had to replace another workflow, though I found it more convenient that a new window popped up to rename a document. However, this looks good! 

thanks for the effort. 

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