Restore via P5 CLI (example)
Posted by Andre Kuehnemund on 02 March 2015 11:39

Example of a restore in P5 using the CLI:


macmini:~ admin$ pwd


macmini:~ admin$ cd /Users/admin/aw/bin

macmini:bin admin$ ./nsdchat -c RestoreSelection create localhost /Users/admin/Desktop/test


macmini:bin admin$ ./nsdchat -c RestoreSelection RestoreSelection.0 findentry 10001 {name == index.html}


macmini:bin admin$ ./nsdchat -c RestoreSelection RestoreSelection.0 findentry 10001 {name *= index}     


macmini:bin admin$ ./nsdchat -c RestoreSelection RestoreSelection.0 submit                              


macmini:bin admin$ 


Please note:

The '6' in the above examples shows that 6 versions of that file were found in the archive index. Only the most recent version can be restored through the CLI at this time.

The '20' in the above example shows that 20 files starting with 'index' were found. Only the most recent version of each file can be restored through the CLI at this time.

The 12171 is the CLI job number.


(1 vote(s))
Not helpful

Comments (4)
Will Luker
11 September 2017 23:33
what if I needed to restore a specific index.html file and not every single file that happens to be called "index.html"?

the command
./nsdchat -c RestoreSelection RestoreSelection.0 findentry 10001 {name == /some/path/index.html}
always returns 0.
How can we specify the full path of the files we want to restore?
Andre Kuehnemund
08 December 2017 16:41
To restore a specific file, you would need to se the 'RestoreSelection <name> addentry <archiveentry> [<path>]' command. For that you would need the archive handle of that file. The handle can be obtained using the 'ArchiveEntry handle <client> <path> [<database>]'.
So, in essence, run the ArchiveEntry handle command, then use the handle with the RestoreSelection addentry command.
Jason Whelehon
04 June 2019 22:40
Can you provide a coherent example of this?
Andre Kuehnemund
06 August 2019 21:02
Please refer to the examples of CLI commands listed here:


Get the archive handle for file '/Users/admin/Desktop/zzlexx.dylib':

[root@freenas] /mnt/awpool/aw/bin# ./nsdchat -c ArchiveEntry handle localhost /Users/admin/Desktop/zzlexx.dylib


[root@freenas] /mnt/awpool/aw/bin#

Once you have the archive handle, you add it to the restore selection you created earlier (see example in this KB article):

sh-3.2# /usr/local/aw/bin/nsdchat -c RestoreSelection RestoreSelection.3 addentry Default-Archive#L1VzZXJzL2FkbWluL0Rlc2t0b3AvenpsZXh4LmR5bGli localhost:/Users/admin/Documents/



You submit the restore selection for execution and the file should be restored to the alternate restore path specified (localhost:/Users/admin/Documents/).
Post a new comment
Full Name:
CAPTCHA Verification 
Please enter the text you see in the image into the textbox below (we use this to prevent automated submissions).