How to move all files plus hidden to folder down

filesrename

I want to move all my drupal files in www folder to html folder. I don't know how to do this in terminal and I'm not sure if all folder and files including hidden ones are drupal in the www folder, is there a way of checking the lesser obvious ones or would www have been empty before and any hidden files will auto recreate?

Best Answer

With zsh:

mv -- *(D) html

mv will complain that it can't move html to itself, but will still move the rest.

With bash:

shopt -s dotglob
mv -- * html

With ksh93:

FIGNORE='@(.|..)'
mv -- * html

POSIXly:

mv -- * .??* .[!.] html

or

mv -- * .[!.]* ..?* html

(you're likely to get errors for those of the patterns that have no match. That should be harmless but will still cause the exit status to be non-zero so in script you would not be able to distinguish that with a failure to move files).

Related Question