To get file (MDF/LDF) information we can write following query
GO
EXEC sp_MSforeachdb ‘USE ? Execute sp_helpFile’
Or we can write following command
Go
EXEC sp_MSforeachdb ‘USE ? SELECT ”?”, SF.filename, SF.size FROM sys.sysfiles SF’
Go
Or we can write following command
GO
SELECT Name,Physical_name As current_file_Location
From sys.master_Files
Enjoy !!!