xilopaint Posted April 24, 2017 Share Posted April 24, 2017 The workflow doesn't work if the new filename has a /. Link to comment
xilopaint Posted April 25, 2017 Share Posted April 25, 2017 9 hours ago, xilopaint said: The workflow doesn't work if the new filename has a /. Never mind. I just realized I can get the / using a : instead. Link to comment
vitor Posted May 8, 2017 Author Share Posted May 8, 2017 Update. Faster code, without temporary files. Also, new icon. To update, download the latest version (same URL) or wait a few days (15 or less) and it’ll prompt you to on next usage, since it uses OneUpdater. Link to comment
pontus Posted August 15, 2017 Share Posted August 15, 2017 Great workflow, very useful, thanks! I want to trigger it externally (as described here) but then the external trigger must be placed before the parsing script. Any specific reason for the placement of the trigger? Link to comment
vitor Posted August 15, 2017 Author Share Posted August 15, 2017 1 hour ago, pontus said: Great workflow, very useful, thanks! Thank you. Glad you find it useful. 1 hour ago, pontus said: I want to trigger it externally (as described here) but then the external trigger must be placed before the parsing script. To trigger it externally, you’ll need to add an External Trigger that connects to the top Run Script. 1 hour ago, pontus said: Any specific reason for the placement of the trigger? Yes. Admittedly that External Trigger is more like an Internal Trigger. It’s not meant to ever be called from outside the Workflow. I’m using it as a trick to pass a bunch of variables around without having to resort to temporary files. Link to comment
pontus Posted August 15, 2017 Share Posted August 15, 2017 Yeah I've added another external. Maybe a new feature in the workflow? (Shouldn't every workflow have an external trigger hehe). For me it works fine without the "trick", is it for older versions of alfred? Link to comment
vitor Posted August 15, 2017 Author Share Posted August 15, 2017 56 minutes ago, pontus said: (Shouldn't every workflow have an external trigger hehe). Issue is some Workflows have so many possible inputs, adding an External Trigger for all can become quite a mess. So I typically only add the ones I need or that I think will be particularly useful. If someone else needs another, its easy enough to add and I can even help the user make it custom. 1 hour ago, pontus said: For me it works fine without the "trick", is it for older versions of alfred? You’d need to show me your version working without for me to say for sure if I could use your approach. Link to comment
pontus Posted August 24, 2017 Share Posted August 24, 2017 On 8/16/2017 at 1:32 AM, vitor said: You’d need to show me your version working without for me to say for sure if I could use your approach. This works fine for me: https://www.dropbox.com/s/7d357bo5wch0j46/Rename (version).alfredworkflow?dl=0 Link to comment
vitor Posted August 24, 2017 Author Share Posted August 24, 2017 @pontus You’re right. Not sure why I’ve built it like that at the time. I probably didn’t think about it that way, since this Workflow exists since Alfred 2 and at the time it required a lot more workarounds. Thank you. Updated to fit your model. Link to comment
pontus Posted August 24, 2017 Share Posted August 24, 2017 Yeah that's what I figured Link to comment
pacifist Posted October 8, 2017 Share Posted October 8, 2017 This is a very helpful workflow - it functions well and I also edited it to post a notification that says "Renamed from {var:oldfilename} to {var:newfilename}". However I did notice that if you rename file A the name of an existing file B of the same type in the same directory it overwrites file B (and I have no idea where the old one goes - not in the trash . Hopefully and presumably something the filesystem can manage). Similarly renaming folder A to the name of folder B in the same directory will move folder A into folder B. Ideally both of these scenarios would report an error and not follow through with the operation, or utilize similar behavior as Finder, by addending "1" "2" "3" etc. to the new file name (or if that's not possible perhaps addending "copy from {time}" to the filename using the {time} dynamic placeholder as a unique identifier) Let me if I'm missing something, but for now I won't use this since I may accidentally delete files with it. Thanks! Link to comment
deanishe Posted October 8, 2017 Share Posted October 8, 2017 @pacifist Yeah, that sounds like the default behaviour of the mv command. I agree that smarter behaviour would be preferable, especially not silently overwriting existing files. Link to comment
vitor Posted October 8, 2017 Author Share Posted October 8, 2017 8 hours ago, deanishe said: Yeah, that sounds like the default behaviour of the mv command. It is. 10 hours ago, pacifist said: similar behavior as Finder, by addending "1" "2" "3" etc. to the new file name That’s for copying files. Finder doesn’t have such a scheme for renaming — it aborts and tells you to pick a different name. 10 hours ago, pacifist said: (or if that's not possible perhaps addending "copy from {time}" to the filename using the {time} dynamic placeholder as a unique identifier) Made it into something like that. If the path already exists, it’ll append the date and time to the name (and in the extremely unlikely event a file name with that exact same date string already existed, it’ll try again until it’s sure the name is unique. Link to comment
vitor Posted October 8, 2017 Author Share Posted October 8, 2017 Update. Prevent overwriting files. Also updated to the latest version of OneUpdater (including lowering the update check frequency to 4 days). 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 Posted May 31, 2018 Author Share Posted May 31, 2018 Update. Do not ignore text after dot for directories. 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
proxemics Posted June 26, 2019 Share Posted June 26, 2019 (edited) This is great, thank you so much! One question, I am trying to augment this to duplicate a file first before renaming it. I am able to duplicate the file, but I can't figure out how to rename the duplicated file, it always renames the original file? Is there a simple one to do duplicate the file first and rename the duplicate? thanks so much! -------------------- Update: I was able to find a work around by creating a hotkey for this workflow, and then creating a separate workflow that executes a key combo to duplicate a file, then another key combo for this workflows hotkey. Whew. Bit of a round about, but it works! I was also able to make a tiny edit to the bash script to remove the 'copy' in the duplicated file name as well. Thanks again for the great workflow! Edited June 26, 2019 by proxemics vitor 1 Link to comment
politicus Posted August 13, 2019 Share Posted August 13, 2019 Top workflow ! Thanks @vitor ! vitor 1 Link to comment
heyJoeCampbell Posted May 18, 2021 Share Posted May 18, 2021 Hi @vitor how can I get the workflow work recursively? Link to comment
vitor Posted May 18, 2021 Author Share Posted May 18, 2021 4 hours ago, heyJoeCampbell said: how can I get the workflow work recursively? Either I don’t understand what you want (please elaborate), or the answer to your question is probably in the README (please see the top post). Link to comment
heyJoeCampbell Posted May 20, 2021 Share Posted May 20, 2021 On 5/18/2021 at 7:43 PM, vitor said: Either I don’t understand what you want (please elaborate), or the answer to your question is probably in the README (please see the top post). My apologies - I thought the workflow had the ability to perform Find & Replace when renaming folders and files. But is does warrant the consideration for the developing such a workflow: Select Folder via file action Enter search string Enter replace string The workflow then replaces all instances of the string recursively. Does it sound like a worthy workflow? Link to comment
vitor Posted May 22, 2021 Author Share Posted May 22, 2021 On 5/20/2021 at 7:41 AM, heyJoeCampbell said: Does it sound like a worthy workflow? I have built Workflows that literally no one else in the world could or would want to use. I’ve also built Workflows on request which I’m pretty sure only one person in the world uses. Whatever you find worthy to build as a Workflow is up to you. Or are you asking if I would build this one, like I’ve built others for you in the past? Because if so, please just say that. I appreciate straightforwardness and find it hard to communicate when I feel the subject is being tip-toed around. Either way, I’ll pass on this one. I’ve been prioritising adding major improvements to my main Workflows this week and I’m predicting that what you’re asking for will be more effort than it’s worth. As someone who has built several tools to handle renaming, it takes too much testing and checking for edge cases, seeing as it’s potentially destructive. Link to comment
heyJoeCampbell Posted May 22, 2021 Share Posted May 22, 2021 Understood - and I apologize for tiptoeing. vitor 1 Link to comment
vitor Posted June 5, 2021 Author Share Posted June 5, 2021 (edited) @heyJoeCampbell I had an idea and made a Workflow to satisfy what you asked for [link removed after download]. Instead of building and testing all the logic, I remembered I could use another tool for this. This received limited testing, so you use it at your own risk! I don’t think anything bad is going to happen, but who knows if you use some weird shell characters that get expanded to something they shouldn’t or the like. It’s a File Action which only works on directories, and one at a time. Select the directory, press the shortcut, then give the “from” and “to” strings you want to modify. All file and children directories will be renamed with that substitution. Edited June 5, 2021 by vitor Link to comment
heyJoeCampbell Posted June 5, 2021 Share Posted June 5, 2021 Thank you vitor, I tried the workflow, but it only seems to change the parent directory and not the subfolder or files. Perhaps I am doing something wrong, below are screenshots of what I did: Link to comment
vitor Posted June 5, 2021 Author Share Posted June 5, 2021 See, I told you about the limited testing! An issue of that tool (which may be addressed on a future update, they say) is that it acts on the whole path, so it may rename a directory and then can’t get to the files inside (because the parent’s name changed). So you can avoid that by not having the parent directory be named with what you want to replace. These are the types of issues I was talking about that require a bunch of testing. So as I expect you understand, I won’t keep iterating on it. If they update the tool (you may ask, I suppose) and you let me know, I may update the Workflow accordingly. Link to comment
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now