|1||Did do a restore.|
|0||Did not do a restore.|
|FilePathValue||File path of original, without the .bak extension.|
|Extension||Optional. Name of the extension the backup version should have. Defaults to bak.|
RestoreIfExists my.txtwill look for a file called
my.txt.bak, and if it finds one then it will copy from that to
Again, note that "IfExists" here refers to the version with the extension (and not the original). So, if you have
foo.txt, back it up as
foo.txt.bak, and delete the original, then
RestoreIfExists foo.txt will create
foo.txt. On the other hand, if you have
foo.txt and do not back it up (so there is no such file as
foo.txt.bak) and then you call
RestoreIfExists foo.txt, it will not be an error but rather it will do nothing and return zero.
This command is meant to be paired with BackupIfExists to make for a very primitive, "one version only" backup mechanism to use with applications.