Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

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?

share|improve this question

3 Answers 3

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).

share|improve this answer
    
Oh I wish I had seen this before- very helpful. I ended up uploading to html directory a fresh install and now the other is still residing other folder so I will just remove what I know to be drupal I guess. Thanks. I will copy this above info for future ref. –  freja Nov 30 '12 at 8:46

The easy way:

# from the www directory
cd ..
mv www html
mkdir www
mv html www/

This assumes you don't already have a html directory at the same level as www. If you do, pick a different name:

cd ..
mv www temp_name
mkdir www
mv temp_name www/html
share|improve this answer
1  
remember to check access permissions and ownership if you're to recreate a directory that existed before. –  Stéphane Chazelas Nov 30 '12 at 21:30

A naive option (don't try it!) would be: mv * .* html - this will however try to move . and .. too, which is not quite what you want. I usually do something like mv * .??* html - this moves normal file and hidden files with names that have at least 3 characters in them, effectively skipping . and ..

share|improve this answer
    
That would skip .a and .z as well. –  Stéphane Chazelas Nov 30 '12 at 7:41
    
Thanks but how do I know what files are assoc with drupal, is there a way to ask the system? –  freja Nov 30 '12 at 8:47

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.