A snapshot is basically a recursive copy of all directories, and this seems inevitable. From a recovery point of view, simply delete the directory and rename the temporary directory with the original name.
If this is for functional testing, how about having a well-known reference and copying it at the beginning of the test? Thus, snapshots are not taken. This only works, of course, if you always start with a well-known set of files.
Regarding the actual recursive copy, Apache has a method for doing this in Commons-IO, as well as for a recursive deletion .
source share