backup and sync

backupfolder - backup a folder, syncfolder - sync folders, revertbackup - revert previous backups
Updated 31 May 2011

View License

copytofolder backup a folder under another folder.

backup(p1, p2) backup the folder p1 under p2. It will make a directory named today's date under p2. The backup will backup all the modified and newly added files but ignored the unchanged files.

REVERTBACKUP revert backups

revertbackup(revertPath, backupPath, savePath), 'backupPath' is a path to save the backups which are created by function 'backupfolder'. revertbackup reverts all files under 'revertPath' under 'backupPath', and saves newest version of every files. The 'savePath' is the path to save the reverted files.

revertbackup(..., begDate) only revert the backups later than begDate. The backups earlier than begDate wil be ignored.


SYNCFOLDER sync two folds

syncfolder(p1, p2, syncdirect), sync between p1 and p2. p1 and p2 are two directories. The exact behavior depends on the third parameter 'syncdirect'

syncdirect = 0, p1 and p2 are synced two-ways, i.e. the newest file will be the final one.

syncdirect = 1, p1 are synced to p2 (the change in p2 will not synced to p1);

syncdirect = 2, p1 are synced to p2, and the file in p2 but not in p1 will be deleted

syncdirect = -1, p2 are synced to p1;

syncdirect = -2, p2 are synced to p1, and the file in p1 but not in p2 will be deleted

syncdirect is 0 by default.

Test under windows XP & Matlab 2010b
Chinese introduce could be found here:

Cite As

Zhiqiang Zhang (2024). backup and sync (, MATLAB Central File Exchange. Retrieved .

MATLAB Release Compatibility
Created with R2010b
Compatible with any release
Platform Compatibility
Windows macOS Linux
Find more on Source Control Integration in Help Center and MATLAB Answers
Tags Add Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
Version Published Release Notes

fixed a bug: user defined function "sortstruct" was missed before.