Using XXCopy to clone and compress your files for backup

You can use XXCOPY (www.xxcopy.com) to write simple backup scripts to copy your files to remote storage locations, but you can also use it to compress those files on the NTFS file system.

I have used /CLONE in the past because it’s easy, but a side effect is that all the files will maintain their attributes when copied to the destination.  What this means is that if a file is not compressed at the source, it won’t be compressed at the destination, even if you set the destination folder/drive to be compressed.

To solve this problem you just need to first set the compression attribute of the container of the location you are copying files too, and then use a switch to tell xxcopy to only set the “normal” attribute, which I belive sets the “A” attribute.  Either way, it works.

xxcopy E: /s /ASDC
xxcopy E: /s /AS:C
xXcopy D:FolderRoot*.* E:FolderRoot /CLONE /YY /Z0 /KN

The code here is backing up everything in D:FolderRoot to the E: with compression.

The first step sets the E: to be a compressed drive (this will work for any folder, not just the root of the drive).

The second step sets all files in all folders to be compressed.  This is just to make sure that when this runs at night, no files are missed.

The last step copies all files from the folder we care about, and the /KN swtich allows the destination files to inherit the “C” (compression) attribute from the parent folder.

 

Advertisement

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s