• Does your instance of SQL Server have xp_cmdshell enabled? If so you can capture the result of the DOS command "DIR" into a table variable containing the date and time. Here is a snippet of code that I use for looking for database backups using this method:

    set @FullyQualifiedPath = @BackupPath + '\' + @Database_Name

    set @DirectoryCmd = 'dir /b /o:-d ' + @FullyQualifiedPath + '\*.bak'

    delete from @DatabaseBackups

    insert into @DatabaseBackups (BackupFileName)

    exec xp_cmdshell @DirectoryCmd

    delete from @DatabaseBackups

    where BackupFileName is null or

    charindex(@TodayDate, BackupFileName) = 0

    Here is the table definition for @DatabaseBackups:

    declare @DatabaseBackups table (database_id int

    ,BackupFileName varchar(max))

    This gives you an idea what you can do. You can capture the date/time of the files then process what ever you want.

    Hope this helps.

    Kurt

    Kurt W. Zimmerman
    SR DBA
    Lefrak Organization
    New York, NY

    http://www.linkedin.com/in/kurtwzimmerman