简体   繁体   中英

Check if remote firebird backup file exists

I've found out how to perform a streamed backup from this post .

Now, I'm facing the reverse problem - I want to perform a restore from a backup file. It is quite easy when I have a local backup file - the problem is, how to check if the remote backup file exists?

Example: my connection string is as follows : datasource=192.168.1.123;database=D:/data/MyDatabase.FDB;...

And I want to check if the file \\\\192.168.1.123/D:/data/MyDatabase.fbk exists before running the restore service. Note that File.Exists(@"\\\\192.168.1.123/D:/data/MyDatabase.fbk") returns false. I don't really know how to make sure the file exists before running the restore. Any idea?

Just perform the restore and Firebird will return an error if the backup file does not exist. If the backup file does not exist, Firebird will return error:

cannot open backup file <backup-path>
Exiting before completion due to errors

Alternatively, you need to have some form of remote access to the other system to check its filesystem. Firebird itself doesn't offer such an option (apart from just trying the restore and see if it works).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM