Using version 8.9.1. Trying to restore the latest .bak file in a selected folder as the Restore Source. The file is SFTP'ed unencrypted each night. Using the Restore Wizard and the job is failing when I change one parameter. At "Latest backup search method" the job succeeds when I choose "Specific backup file name". When I change it to "Folder scan", it fails. I'm tired of having to do this manually. Any ideas on how to fix this?
@backuppath = N'E:\backups\',
@backupextension = N'',
@checksubfolders = 0,
@sourceserver = N'(server name)',
@sourcedatabase = N'(DB name)',
@backuptype = N'full',
@affinity = 0,
@logging = 0,
@withreplace = 1,
@DontUseReplication = 1,
@IncludeAGReplicas = 1,
@checkdb = 1,
@checkdbphysicalonly = 1,
@checkdbnoindex = 1,
@checkdbnoinfomessages = 1,