1

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?

3 Answers 3

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

1
  • 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. Commented Nov 30, 2012 at 8:46
2

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 
1
  • 1
    remember to check access permissions and ownership if you're to recreate a directory that existed before. Commented Nov 30, 2012 at 21:30
0

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

2
  • That would skip .a and .z as well. Commented Nov 30, 2012 at 7:41
  • Thanks but how do I know what files are assoc with drupal, is there a way to ask the system? Commented Nov 30, 2012 at 8:47

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.