This article is a mirror article of machine translation, please click here to jump to the original article.

View: 30045|Reply: 8

[windows] Windows uses cwRsync (Rsync) to synchronize two disk files

[Copy link]
Posted on 9/19/2021 12:46:35 PM | | | |
Since you are ready to reinstall Windows 11 and want to back up the files of the original disk to the new disk, then format all the disks.

The easiest way is to copy and paste, today use cwRsync(Rsync) to synchronize two folders (if the synchronization of two folders is realized, that is, the synchronization of two disks),cwRsync can implement incremental backup, that is, the source backup to the target, it will only copy and paste files that the target does not have from the source, if the source and the target have the same file name and different content, cwRsync will overwrite the source files to the target

rsync is a file synchronization tool on Linux that uses its unique algorithm to synchronize two directories natively or across machines. This very useful tool is also available on Windows and is called cwRsync.

Download cwRsync

Address:The hyperlink login is visible.



Alternate download address:The hyperlink login is visible.

Decompression and setting environment variables

I extracted the downloaded package to the D:\dev_tools\cwrsync_client_6.2.2_x64_free directory, below, and then permanently added rsync.exe to the environment variables using the following command line:

cmd to set the permanent environment variable command
https://www.itsvse.com/thread-9230-1-1.html



The command line parameters are as follows:

Usage: rsync [OPTION]... SRC [SRC]... DEST
  or   rsync [OPTION]... SRC [SRC]... [USER@] HOST:DEST
  or   rsync [OPTION]... SRC [SRC]... [USER@] HOST::DEST
  or   rsync [OPTION]... SRC [SRC]... rsync://[USER@]HOST[:PORT]/DEST
  or   rsync [OPTION]... [USER@] HOST:SRC [DEST]
  or   rsync [OPTION]... [USER@] HOST::SRC [DEST]
  or   rsync [OPTION]... rsync://[USER@]HOST[:PORT]/SRC [DEST]
The ':' usages connect via remote shell, while '::' & 'rsync://' usages connect
to an rsync daemon, and require SRC or DEST to start with a module name.

Options
--verbose, -v            increase verbosity
--info=FLAGS             fine-grained informational verbosity
--debug=FLAGS            fine-grained debug verbosity
--stderr=e|a|c           change stderr output mode (default: errors)
--quiet, -q              suppress non-error messages
--no-motd                suppress daemon-mode MOTD
--checksum, -c           skip based on checksum, not mod-time & size
--archive, -a            archive mode; equals -rlptgoD (no -H,-A,-X)
--no-OPTION              turn off an implied OPTION (e.g. --no-D)
--recursive, -r          recurse into directories
--relative, -R           use relative path names
--no-implied-dirs        don't send implied dirs with --relative
--backup, -b             make backups (see --suffix & --backup-dir)
--backup-dir=DIR         make backups into hierarchy based in DIR
--suffix=SUFFIX          backup suffix (default ~ w/o --backup-dir)
--update, -u             skip files that are newer on the receiver
--inplace                update destination files in-place
--append                 append data onto shorter files
--append-verify          --append w/old data in file checksum
--dirs, -d               transfer directories without recursing
--mkpath                 create the destination's path component
--links, -l              copy symlinks as symlinks
--copy-links, -L         transform symlink into referent file/dir
--copy-unsafe-links      only "unsafe" symlinks are transformed
--safe-links             ignore symlinks that point outside the tree
--munge-links            munge symlinks to make them safe & unusable
--copy-dirlinks, -k      transform symlink to dir into referent dir
--keep-dirlinks, -K      treat symlinked dir on receiver as dir
--hard-links, -H         preserve hard links
--perms, -p              preserve permissions
--executability, -E      preserve executability
--chmod=CHMOD            affect file and/or directory permissions
--acls, -A               preserve ACLs (implies --perms)
--xattrs, -X             preserve extended attributes
--owner, -o              preserve owner (super-user only)
--group, -g              preserve group
--devices                preserve device files (super-user only)
--specials               preserve special files
-D                       same as --devices --specials
--times, -t              preserve modification times
--atimes, -U             preserve access (use) times
--open-noatime           avoid changing the atime on opened files
--crtimes, -N            preserve create times (newness)
--omit-dir-times, -O     omit directories from --times
--omit-link-times, -J    omit symlinks from --times
--super                  receiver attempts super-user activities
--fake-super             store/recover privileged attrs using xattrs
--sparse, -S             turn sequences of nulls into sparse blocks
--preallocate            allocate dest files before writing them
--write-devices          write to devices as files (implies --inplace)
--dry-run, -n            perform a trial run with no changes made
--whole-file, -W         copy files whole (w/o delta-xfer algorithm)
--checksum-choice=STR    choose the checksum algorithm (aka --cc)
--one-file-system, -x    don't cross filesystem boundaries
--block-size=SIZE, -B    force a fixed checksum block-size
--rsh=COMMAND, -e        specify the remote shell to use
--rsync-path=PROGRAM     specify the rsync to run on remote machine
--existing               skip creating new files on receiver
--ignore-existing        skip updating files that exist on receiver
--remove-source-files    sender removes synchronized files (non-dir)
--del                    an alias for --delete-during
--delete                 delete extraneous files from dest dirs
--delete-before          receiver deletes before xfer, not during
--delete-during          receiver deletes during the transfer
--delete-delay           find deletions during, delete after
--delete-after           receiver deletes after transfer, not during
--delete-excluded        also delete excluded files from dest dirs
--ignore-missing-args    ignore missing source args without error
--delete-missing-args    delete missing source args from destination
--ignore-errors          delete even if there are I/O errors
--force                  force deletion of dirs even if not empty
--max-delete=NUM         don't delete more than NUM files
--max-size=SIZE          don't transfer any file larger than SIZE
--min-size=SIZE          don't transfer any file smaller than SIZE
--max-alloc=SIZE         change a limit relating to memory alloc
--partial                keep partially transferred files
--partial-dir=DIR        put a partially transferred file into DIR
--delay-updates          put all updated files into place at end
--prune-empty-dirs, -m   prune empty directory chains from file-list
--numeric-ids            don't map uid/gid values by user/group name
--usermap=STRING         custom username mapping
--groupmap=STRING        custom groupname mapping
--chown=USER:GROUP       simple username/groupname mapping
--timeout=SECONDS        set I/O timeout in seconds
--contimeout=SECONDS     set daemon connection timeout in seconds
--ignore-times, -I       don't skip files that match size and time
--size-only              skip files that match in size
--modify-window=NUM, -@  set the accuracy for mod-time comparisons
--temp-dir=DIR, -T       create temporary files in directory DIR
--fuzzy, -y              find similar file for basis if no dest file
--compare-dest=DIR       also compare destination files relative to DIR
--copy-dest=DIR          ... and include copies of unchanged files
--link-dest=DIR          hardlink to files in DIR when unchanged
--compress, -z           compress file data during the transfer
--compress-choice=STR    choose the compression algorithm (aka --zc)
--compress-level=NUM     explicitly set compression level (aka --zl)
--skip-compress=LIST     skip compressing files with suffix in LIST
--cvs-exclude, -C        auto-ignore files in the same way CVS does
--filter=RULE, -f        add a file-filtering RULE
-F                       same as --filter='dir-merge /.rsync-filter'
                         repeated: --filter='- .rsync-filter'
--exclude=PATTERN        exclude files matching PATTERN
--exclude-from=FILE      read exclude patterns from FILE
--include=PATTERN        don't exclude files matching PATTERN
--include-from=FILE      read include patterns from FILE
--files-from=FILE        read list of source-file names from FILE
--from0, -0              all *-from/filter files are delimited by 0s
--protect-args, -s       no space-splitting; wildcard chars only
--copy-as=USER[:GROUP]   specify user & optional group for the copy
--ignore-case            ignore case when comparing filenames
--address=ADDRESS        bind address for outgoing socket to daemon
--port=PORT              specify double-colon alternate port number
--sockopts=OPTIONS       specify custom TCP options
--blocking-io            use blocking I/O for the remote shell
--outbuf=N| L|B           set out buffering to None, Line, or Block
--stats                  give some file-transfer stats
--8-bit-output, -8       leave high-bit chars unescaped in output
--human-readable, -h     output numbers in a human-readable format
--progress               show progress during transfer
-P                       same as --partial --progress
--itemize-changes, -i    output a change-summary for all updates
--remote-option=OPT, -M  send OPTION to the remote side only
--out-format=FORMAT      output updates using the specified FORMAT
--log-file=FILE          log what we're doing to the specified FILE
--log-file-format=FMT    log updates using the specified FMT
--password-file=FILE     read daemon-access password from FILE
--early-input=FILE       use FILE for daemon's early exec input
--list-only              list the files instead of copying them
--bwlimit=RATE           limit socket I/O bandwidth
--stop-after=MINS        Stop rsync after MINS minutes have elapsed
--stop-at=y-m-dTh:m      Stop rsync at the specified point in time
--write-batch=FILE       write a batched update to FILE
--only-write-batch=FILE  like --write-batch but w/o updating dest
--read-batch=FILE        read a batched update from FILE
--protocol=NUM           force an older protocol version to be used
--iconv=CONVERT_SPEC     request charset conversion of filenames
--tr=BAD/GOOD            transliterate filenames
--checksum-seed=NUM      set block/file checksum seed (advanced)
--ipv4, -4               prefer IPv4
--ipv6, -6               prefer IPv6
--version, -V            print the version + other info and exit
--help, -h (*)           show this help (* -h is help only on its own)

Use "rsync --daemon --help" to see the daemon-mode command-line options.
Please see the rsync(1) and rsyncd.conf(5) man pages for full documentation.
SeeThe hyperlink login is visible.for updates, bug reports, and answers

Instructions for use:

For example, if you synchronize a directory file to directory B, the directory in this example uses a relative path.


-av -a, --archive archive mode, which means transferring files recursively, and keeping all file attributes, equal to -rlptgoD; -v,--verbose verbose output in verbose mode.
--progress shows the transfer process.
--delete-after Delete after the transfer is complete.
--exclude skip files or directories.

a/ source directory, b/ target directory. Relative paths can be used here, as well as absolute paths.

The first sync will sync all files, and each subsequent sync will only sync files with differences.

Folder contents are synchronized

Synchronize the contents of the D:\itsvse\source folder to the D:\itsvse\target folder, and exclude .svn, . git directory, the command is as follows:

Because this is a tool ported from Linux, when synchronizing across disks, the directory writing method is different from the regular writing method in Windows.

For example, the C drive should be in the format /cygdrive/c/, and the abc directory under the C drive should be written as /cygdrive/c/abc/.



You can save a bat batch file with the command as follows:

(End)





Previous:Java gets full exception information (call stack)
Next:CentOS 7 installs the runtime environment with ASP.NET Core 3.1
 Landlord| Posted on 9/19/2021 12:58:31 PM |
--delete-after deletes files that do not exist in the source, it is recommended to add this parameter.
Posted on 9/19/2021 7:07:10 PM |
Now I have to reply to see it
 Landlord| Posted on 1/2/2022 10:54:10 PM |
Use: rsync [OPTION]... SRC [SRC]... DEST
Access via remote shell:
rsync [options]... [username@] HOST:SRC [DEST]
rsync [options]... SRC [SRC]... [username@] HOST:DEST
Access via rsync daemon:
rsync [options]... [username@] HOST::SRC [DEST]
rsync [options]... SRC [SRC]... [username@] HOST::DEST
rsync [options]... SRC [SRC]... rsync://[username@]HOST[:P ORT]/DEST
rsync [options]... rsync://[USER@]HOST[:PORT]/SRC [DEST]

Note that ':' will use SSH to connect remotely, while '::' and 'rsync://' will be used to connect to an rsync daemon server via tcp, which requires SRC (source) and DEST (purpose) containing the module name

options
-v, --verbose verbose verbose mode output
--info=FLAGS outputs the INFO level
--debug=FLAGS outputs the DEBUG level
--msgs2stderr special output processing for debugging
-q, --quiet ignores non-error output
--no-motd ignores the MOTD of Daemon mode
-c, --checksum make automatic skipping based on checksums instead of the default modification time and file size
-a, --archive Archive (compression) mode, which means transferring files recursively and keeping all file attributes equivalent to -rlptgoD (without -H, -A, -X)
--no-OPTION to turn off implicit options (e.g. --no-D)
-r, --recursive are processed in recursive mode for subdirectories
-R, --relative uses relative path information
--no-implied-dirs does not use --relative to send an implicit directory
-b, --backup Create a backup, that is, if the purpose already exists and has the same file name, rename the old file to ~filename. You can use the --suffix option to specify a different backup file prefix
--backup-dir=DIR Save the backup file (such as ~filename) in the specified directory
--suffix=SUFFIX defines the backup file prefix, which defaults to ~
-u, --update just do the update, that is, skip all files that already exist in DST and are later than the file to be backed up (does not overwrite the updated file)
--inplace update destination files in-place (SEE MAN PAGE)
--append attaches data to shorter files
--append-verify is similar to --append, but checksums are calculated for older data
-d, --dirs do not use recursive transport directories
-l, --links do not handle symlinks (keep symlinks)
-L, --copy-links Treat symbolic links as specific files or folders
--copy-unsafe-links only handles unsafe symlinks
--safe-links ignores symlinks that are not in the SRC source directory
--munge-links munge symlinks make them more secure (but unusable)
-k, --copy-dirlinks convert symbolic links to folders into folders
-K, --keep-dirlinks treats the receiver's symlink to the folder as a folder
-H, --hard-links keep the hard links
-p, --perms reserve permissions
-E, --executability preserves the executable properties of the file
--chmod=CHMOD affects the properties of a file or folder
-A, --acls retains ACLs (stands for --perms)
-X, --xattrs retains the extended property
-o, --owner Retain owner (superuser only)
-g, --group retains the group
--devices Keep device files (superuser only)
--copy-devices Copy the contents of the device file as if it were a file
--specials keeps special files
-D and --devices --specials
-t, --times retains the modification time
-O, --omit-dir-times ignores the modification time of the folder
-J, --omit-link-times ignores the modification time of the symbolic link
--super The receiver tries to operate with superuser
--fake-super uses xattrs to store and restore permission attributes
-S, --sparse special treatment of sparse files to save space
--preallocate pre-allocate DST files before writing
-n, --dry-run performs a test run with no actual changes, and only shows how the file will be manipulated
-W, --whole-file copy the file without incremental detection
-x, --one-file-system do not cross the filesystem boundary
-B, --block-size=SIZE The block size used by the checking algorithm is 700 bytes by default
-e, --rsh=COMMAND Specifies that data synchronization is performed using rsh, ssh
--rsync-path=PROGRAM Specifies the path where the rsync command is located on the remote server
--existing only updates files that already exist in DST, not backing up newly created files
--ignore-existing skips updating files that already exist in DST
--remove-source-files The sender deletes the source file that is not a folder
--del --delete-during
--delete deletes those files that are not in DST that SRC does not have
--delete-before Delete before transfer, not during transfer
--delete-during is deleted during transfer
--delete-delay Determines the one to be deleted during the transfer process, and deletes it after the transfer ends
--delete-after is deleted after the transfer is over, not during the transfer
--delete-excluded also deletes files on the receiving end that are excluded by this option
--ignore-missing-args ignores missing source parameters and does not output errors
--delete-missing-args deletes missing source parameters from DEST
--ignore-errors is removed even if there is an I/O error
--force force delete even if the folder is not empty
--max-delete=NUM does not delete more than the specified number of files
--max-size=SIZE does not transfer files larger than the specified size
--min-size=SIZE does not transfer files smaller than the specified size
--partial retains files that have not been fully transferred for some reason to speed up subsequent retransmission (i.e. breakpoint resumption)
--partial-dir=DIR Places files that have not been fully transferred for some reason to the specified folder
--delay-updates puts all updated files in place at the end of the transfer
-m, --prune-empty-dirs removes the empty directory chain from the file list
--numeric-ids Do not map uid/gid values to user/group names
--usermap=STRING custom username mapping
--groupmap=STRING custom group name mapping
--chown=USER:GROUP simple user/group name mapping
--timeout=SECONDS Sets the I/O timeout in seconds
--contimeout=SECONDS Sets the Daemon connection timeout in seconds
-I, --ignore-times do not skip files that have the same time and size
-M, --remote-option=OPTION only sends the specified option to the remote end
--size-only only only skips files of the same size
--modify-window=NUM The timestamp window used to determine whether a file is time-identical, defaults to 0
-T, --temp-dir=DIR to create a temporary file in the specified folder
-y, --fuzzy If DEST doesn't have any files, look for similar files
--compare-dest=DIR also compares files in DIR to decide if a backup is needed
--copy-dest=DIR is similar to the above, but it also copies the unchanged files in the specified folder
--link-dest=DIR is similar to the above, except that the unchanged file is hardlinked to DST
-z, --compress compress during transmission
--compress-level=NUM specifies compression levels 0-9, with the default being 6
--skip-compress=LIST Skips files with the compressed file suffix in the specified list
-C, --cvs-exclude automatically skips CVS build files
-f, --filter=RULE Add a file filtering rule
-F equals --filter='dir-merge /.rsync-filter'
    Duplicate: --filter='-.rsync-filter'
--exclude=PATTERN excludes files that match the matching rules
--exclude-from=FILE reads the files that need to be excluded from the specified file
--include=PATTERN contains (does not exclude) files that match the matching rules
--include-from=FILE reads the files that need to be included (not excluded) from the specified file
--files-from=FILE reads the list of SRC source files from the specified file
-0, --from0 The filename read from the file terminates with '\0'
-s, --protect-args without space separation; Only special characters for wildcards
--address=ADDRESS to the specified address
--port=PORT Specifies other rsync service ports
--sockopts=OPTIONS Specifies a custom TCP option
--blocking-io uses blocking IO for remote shells
--stats provides the transfer status of certain files
-8, --8-bit-output leaves high-bit characters in the output
-h, --human-readable outputs numbers in a human-readable format
--progress shows progress during transfer
-P is equivalent to --partial --progress
-i, --itemize-changes outputs a summary of changes to all updates
--out-format=FORMAT Output updates in the specified format
--log-file=FILE saves the log to the specified file
--log-file-format=FMT Update the log in the specified format
--password-file=FILE Reads the Daemon server password from the file
--list-only does not copy, but only lists
--bwlimit=RATE limits socket I/O bandwidth
--outbuf=N| L|B sets the output buffer, which is None, Line, or Block
--write-batch=FILE writes to batch updates to the specified file
--only-write-batch=FILE is similar to the above, but with a write-only update to DST
--read-batch=FILE reads a batch update from the specified file
--protocol=NUM enforces the use of the specified older version of the protocol
--iconv=CONVERT_SPEC Perform character encoding conversion of file names
--checksum-seed=NUM sets the checksum seed of the block/file
-4, --ipv4 favors the use of IPv4
-6, --ipv6 favors the use of IPv6
--version prints the version number
(-h) --help displays help information
 Landlord| Posted on 1/3/2022 8:19:55 PM |
Restricted does not allow chmod to change files or directories using non-trivial ACLs. ACLs are trivial if they can be fully represented as file patterns without losing any access rules. Setting ACL mode to restricted is often used to optimize datasets for SMB sharing, but may require further optimization. For example, configuring an rsync task with this dataset may require adding --no-perms as an extra option for the task.

https://www.truenas.com/docs/core/storage/pools/permissions/

Posted on 10/9/2022 4:12:45 PM |
Thank you for sharing!
 Landlord| Posted on 8/27/2023 10:55:27 AM |
 Landlord| Posted on 8/30/2023 6:37:56 PM |
The following command is 10 times faster than right-click copy-paste:

Posted on 12/7/2023 6:31:24 PM |
Learn
Disclaimer:
All software, programming materials or articles published by Code Farmer Network are only for learning and research purposes; The above content shall not be used for commercial or illegal purposes, otherwise, users shall bear all consequences. The information on this site comes from the Internet, and copyright disputes have nothing to do with this site. You must completely delete the above content from your computer within 24 hours of downloading. If you like the program, please support genuine software, purchase registration, and get better genuine services. If there is any infringement, please contact us by email.

Mail To:help@itsvse.com