Move folders that have an apostophe in their name
Hoping this is an easy one - can't quite get it to work.
I need to move all folders, and content (no sub folder) that have at least one apostrophe/quote in their name.
Any pointers?
22 Answers
You need to escape ' using one of the usual escaping methods. BTW the glob pattern you will need is *<glob_pattern_here>*/, the trailing / will make the shell to match only directory(ies).
Using backslash,
\:mv -t /destination/ *\'*/Using double quotes,
":mv -t /destination/ *"'"*/Using single quotes,
', this is actually same as using the backslashed one:mv -t /destination/ *''\'''*
You can do a echo mv ... first as a dry-run. Replace /destination/ with your actual destination.
Also, you can try to use tab-completion if you feel to do it interactively.
2I'm sure there are simpler ways, but this should work in sh with no spaces in the file name
mv *[\"\']*