how to change the file directory of your log and data files and what are the effects
how to change the file directory of your log and data files and what are the effects
  
  Can I just change the settings of the instance to point it to the new
  directory, detach the existing databases move the data files and
  attach it back? Please share what would be the best approach in doing
  this.


Below are two scripts I've used for this purpose quite a few times in the past; just adjust accordingly for your environment.

Basically just plug in the new path locations, the data and log file names, and the logical SQL data and log file names, and then run the first script (see comment above second script below).

First Script

Plug in your variable accordingly for your environment. 

ALTER DATABASE &lt;DBName&gt; SET SINGLE_USER WITH ROLLBACK IMMEDIATE

ALTER DATABASE &lt;DBName&gt; SET OFFLINE

ALTER DATABASE &lt;DBName&gt; MODIFY FILE (
    NAME = &lt;LogicalDataFileName1&gt;
    ,Filename = 'T:\MSSQL\Data\&lt;DBName&gt;.mdf'
    );

ALTER DATABASE &lt;DBName&gt; MODIFY FILE (
    NAME = &lt;LogicalDataFileName2&gt;
    ,Filename = 'T:\MSSQL\Data\&lt;DBName1&gt;.ndf'
    );

ALTER DATABASE &lt;DBName&gt; MODIFY FILE (
    NAME = &lt;LogicalLogFileName2&gt;
    ,Filename = 'Y:\MSSQL\Logs\&lt;DBName&gt;.ldf'
    );




Second Script

Before you run the below TSQL, you will need to move the applicable physical data and log files to the new locations as you plugged into the first script.

--Now move the files to the new location where you pointed them to before running the below.

ALTER DATABASE &lt;DBName&gt; SET ONLINE
ALTER DATABASE &lt;DBName&gt; SET MULTI_USER