• This teaches me to test a lot more before going public. The above didn't really work but this version does (I think).

    if exists (select name from sysobjects where name ='temp_mdf_files') drop table temp_mdf_files

    create table temp_mdf_files (

    full_filename varchar(200))

    insert temp_mdf_files

    exec xp_cmdshell 'dir e:\*.mdf /s/b'

    insert temp_mdf_files

    exec xp_cmdshell 'dir c:\*.mdf /s/b'

    insert temp_mdf_files

    exec xp_cmdshell 'dir d:\*.mdf /s/b'

    select * from temp_mdf_files

    where Upper(full_filename) not in (select Upper(filename) from sysdatabases)

    order by 1

    drop table temp_mdf_files