• I like to have my main data files and log files on different physical drives. Your script will put all of the files for a database in the same place.

    Still is you have to move a whole bunch of databases and are forced (by short sighted managers) to put all the files for a database in the same spot then this can be a great script.

    I agree with the other folks that a better way to move files is through ALTER DATABASE. I had never taken them off-line, or put them in single user mode first. I guess that those are both good ideas.

    One other down side is that you have to enable the command shell. You will turn that off at the end of the script. That could cause something else that relies on the shell to break when you turn it off. I know it's not a good thing to have on so not having to use it would be a good thing. Another reason to use ALTER DATABASE.

    Take some tips for improvement and re-post. Good work.

    ATBCharles Kincaid