Question Can I do a data backup from cmd ?

I think you can do it with the robocopy command using the MIR switch, but I've never used it personally.

Probably other methods too.
Never recommend MIR to n003s. That is expert level only.

if someone doesn’t understand it, it can unintentionally destroy tons of data really quickly. And I know this first hand because someone did it that our company and thank God we have back ups.



Instead of a single, vague question, this would be a great opportunity to describe your situation and your specs, what exactly you want to do and why, and take advantage of hundreds of years of experience that the volunteers here have dealing with nearly every flavor of computer problem.
  • Like
Reactions: Mandark
The one danger with robocopy's /MIR flag is that if the source doesn't have a file that and exists in the destination, it will be deleted in the destination. It literally mirrors the files and directories of the source to the destination.
Indeed, that is a problem for mirrored backup. It's also vulnerable to cryptovirus changing the contents of personal files, then after new backup schedule, the backup copy also become contaminated (assuming user doesn't insert backup drive on an already contaminated computer because then all is lost)

One solution for this: Versioning. I'd looked into this before, and sadly it's no way this can be achieved by native windows tools. As for now, I know ow two ways of solving this:
  • Windows: Use 3. party software. Haven't found a command line tool, but FreeFileSync can do versioning.
  • Linux: A combination or rsync with backup feature and a feature in the shell that can pass t.ex. current date as a variable.
A practical bash command for making a backup with versioning to a sd card may look something like this
$ rsync -abmrtv -L --delete-after --backup-dir='/media/username/media-id/versioning-files/'$(date +"%Y%m%d_%H%M") --log-file='/media/username/media-id/filer/rsync.log' '/home/username/Documents/' '/media/username/media-id/backup-folder/'