2

Why does this work?

mv /Users/diogosaraiva/Music/Youtube/Novas/* /Users/diogosaraiva/Music/Youtube/Tratadas  

…but the commands below don't work?

mv "/Users/diogosaraiva/Music/Youtube/Novas/*" "/Users/diogosaraiva/Music/Youtube/Tratadas"

I had to rename the folder "Youtube" from "Youtube - Downloads", just because this don't work:

mv "/Users/diogosaraiva/Music/Downloads - Youtube/Novas/*" "/Users/diogosaraiva/Music/Downloads - Youtube/Tratadas"

I want integrate this in an Automator app. Is there a better way to move all contents from an folder to another with Automator.app?

5

The space character is used by bash to separate different parameters to a command so you need to protect/escape it if it occurs in filenames (or other parameters):

mv /Users/diogosaraiva/Music/Downloads\ -\ Youtube/Novas/*  /Users/diogosaraiva/Music/Downloads\ -\ Youtube/Tratadas

You can also use quotes to protect the space characters from being misinterpreted by the shell but need to move the * outside the quotes then to allow wildcard expansion:

mv "/Users/diogosaraiva/Music/Downloads - Youtube/Novas/"* "/Users/diogosaraiva/Music/Downloads - Youtube/Tratadas"
  • I worked as two commands... One line command for this, exists? Thanks – DiogoSaraiva Jan 20 '15 at 17:15
  • It is one line actually, but I changed the sample now to make it more obvious. – nohillside Jan 20 '15 at 20:23

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .