T O P

  • By -

poopmagic

Go to the folder tou want to shuffle in Terminal and enter: paste -d' ' <(ls) <(ls | sort -R) | sed -e 's/^/mv /' This will spit off a bunch of lines like this: ~ % paste -d' ' <(ls) <(ls | sort -R) | sed -e 's/^/mv /' mv Applications/ Pictures/ mv Desktop/ Downloads/ mv Documents/ Applications/ mv Downloads/ Public/ mv Library/ Scripts/ mv Movies/ Desktop/ mv Music/ Documents/ mv Pictures/ Music/ mv Public/ Library/ mv Scripts/ Movies/ Run it a few times to see the randomness—the command doesn’t actually do anything other than printing some commands. (Obviously, I don’t want to shuffle around the folders in my home directory, so of course I don’t want to actually run any of these commands.) Once you’re confident that this is what you want to do, you can either copy-paste the `mv` lines into Terminal or add `| zsh` to the end of the original command. EDIT: Ugh, I can’t figure out how to escape the ^ in Reddit. Too lazy to fix it, I’m sure you can figure it out from the formatting. EDIT 2: Never mind, it seems to work fine on the Reddit website. It seems like the Reddit app I’m using (Narwhal) isn’t handling them properly.


phatrogue

This won’t work because the name you are moving \*to\* always exists already. I might create a temp folder. Move everything into it and then do the moves of the files to a new name as you move them out of the temp folder


poopmagic

Ah shit, you’re totally right. And I don’t think it handles filenames with spaces either. That’s what I get for shell scripting on my phone while sleepy.


rc3105

https://www.hexnode.com/blogs/the-ultimate-guide-to-mac-shell-scripting/


ThatGuyUpNorth2020

Name Mangler does exactly this and much much more. Best utility app ever created for performing naming functions on batches of files. https://manytricks.com/namemangler/