July 11, 2019 at 5:05 pm
Can anybody please advise on How can we fetch the list of files present in a location based upon the DateTime in it.
For e.g:-
If there are following files present on the disk:-
master_full_backup_20190701.bak
master_full_backup_20190702.bak
master_full_backup_20190703.bak
model_full_backup_20190701.bak
model_full_backup_20190702.bak
model_full_backup_20190703.bak
I want to extract only the master and model backups taken on 1 July 2019 i.e. which has following data appended to it _20190701
July 11, 2019 at 6:11 pm
Better than looking at the file list would be to look at the backup tables in the msdb database.
use msdb;
select bs.Database_name, bs.user_name, bs.backup_start_date, bs.type, bmf.physical_device_name
from backupset bs join
backupmediafamily bmf on bs.media_set_id = bmf.media_set_id
where bs.database_name = 'master'
order by bs.backup_start_date desc
Viewing 2 posts - 1 through 1 (of 1 total)
You must be logged in to reply to this topic. Login to reply
This website stores cookies on your computer.
These cookies are used to improve your website experience and provide more personalized services to you, both on this website and through other media.
To find out more about the cookies we use, see our Privacy Policy