SQL Server Performance

.BAK Files

Discussion in 'General DBA Questions' started by ranjandba, Jan 10, 2006.

  1. ranjandba New Member

    how can i find total .BAK files in specific drive using sql server 2000
  2. Madhivanan Moderator

    Do you mean you want to find how many .Bak files in the specified folder?

    Madhivanan

    Failing to plan is Planning to fail
  3. ranjandba New Member

    yes i want to know how many .BAK files in specific drive and the size of that files also
  4. gkrishn New Member

    Use Master
    Go
    xp_fixeddrives 'D:MSSQLBACKUP*.BAK'

    Change according to your requiremnt.
  5. satya Moderator

    CREATE FUNCTION dbo.fn_file_exists(@filename VARCHAR(300))
    RETURNS INT
    AS
    BEGIN

    DECLARE @file_exists AS INT
    EXEC master..xp_fileexist @filename, @file_exists OUTPUT
    RETURN @file_exists

    END
    GO

    Keep in mind XP_FILEEXIST is an undocumented SP.

    Satya SKJ
    Contributing Editor & Forums Moderator
    http://www.SQL-Server-Performance.Com
    This posting is provided “AS IS” with no rights for the sake of knowledge sharing.
  6. FrankKalis Moderator

Share This Page