It is always a good idea to keep backups of your stuff. Unfortunately, some folders like %APPDATA%
can not be copied while Windows has locked files inside. That's where the Volume Shadow Copy Service (VSS) comes into play. It basically creates a consistent snapshot of the data and allows to access it regardless of file locks. I wrote a small batch script for Windows 7 that does the following:
- Create snapshot of folder
- Mirror the folder to another place
- Destroy snapshot
The script relies on three tools, only one of which ships with the vanilla Windows 7 installation. These are the dependencies:
vshadow.exe
(part of the Windows 7 SDK:Bin\x64\vsstools\vshadow.exe
)dosdev.exe
(part of the free Volume Shadow Copy Simple Client)robocopy.exe
(installed with Windows 7)
You can download the batch file below. It creates a backup of your own user's %APPDATA%
folder (C:\Users\USERNAME\AppData\Roaming
) to the target folder D:\Backup\AppData
. The script needs to run as Administrator in order to create snapshots.
Download: backup_appdata.cmd