1

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?

guntbert
  • 13,134
pee2pee
  • 151

2 Answers2

2

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.

heemayl
  • 91,753
0

I'm sure there are simpler ways, but this should work in sh with no spaces in the file name

mv *[\"\']*