SYNCNot in LE
Print Topic  Return to Overview  Previous Topic  Next Topic 
Purpose:Synchronize two directories

 

Format:SYNC [/A:... /C /D /E /F /G /J /K /L /M /N[est] /O /P /Q /R /S[n] /T /V /W /X] dir1 dir2

 

dir1First directory (and source for a /W)
dir2Second directory (and target for a /W)

 

/A:...

Attribute switch

/M

Modified files (not Archived)

/C.

Changed source files

/N

Disable

/D

Copy encrypted files

/O

Only if no target file

/E

No error messages

/P

Prompt

/F

No empty subdirectories

/Q

Quiet

/G

Display percentage completed

/R

Replace

/H

H(idden included)

/S

Subdirectories included

/I"text"

Match description

/T

Totals

/J

Restartable copy

/V

Verify

/K

Keep RDONLY attribute

/W

Delete non-matching target

/L

ASCII-mode FTP transfer

/X

(Clear archive bit)

 

See also: COPY and MOVE.

 

File Selection

 

Supports extended wildcards and ranges.

 

Internet: Can be used with FTP servers.

 

Usage:

 

SYNC will synchronize two directories, copying the updated files from each directory to the other.

 

Options:

 

/A:...Select only those files that have the specified attribute(s) set. See Attribute Switches for information on the attributes which can follow /A:. See the cautionary note under Advanced Features above before using /A: when both dir1 and dir2 contain file descriptions. Do not use /A: with @file lists. See @file lists for details. Hidden or system files selected by this option overwrite hidden or system files in the target directory.

 

/CCopy files only if the destination file exists and is older than the source file. This option is useful for updating the files in one directory from those in another without copying any files not already in the target directory.  Do not use /C with @file lists. See @file lists for details.

 

/D(Windows XP+ Only) Force copy of an encrypted file even when the target will be decrypted.

 

/ESuppress all non-fatal error messages, such as File not found or Can't copy file to itself. Fatal error messages, such as Drive not ready, will still be displayed. This option is most useful in batch files and aliases.

 

/FWhen used with /S, SYNC will not create any empty subdirectories.

 

/GDisplays the percentage copied, the transfer rate (in Kbytes/second), and the estimated time remaining. Useful when copying large files across a network or via FTP to ensure the copy is proceeding. When /V is also used, reports percentage verified.

 

/HCopy all matching files including those with the hidden and/or system attribute set. See the cautionary note under Advanced Features above before using /H when both dir1 and dir2 contain file descriptions.

 

/I"text"Select source files by matching text in their descriptions. See Description Ranges for details.

 

/JCopy the files in restartable mode. The copy progress is tracked in the destination file in case the copy fails. The copy can be restarted by specifying the same source and destination file names.

 

/K(Keep read-only attribute)  SYNC normally maintains the hidden and system attributes, sets the archive attribute, and removes the read-only attribute on the target file. /K tells SYNC to also maintain the read-only attribute on the destination file.

 

/LPerform FTP transfers in ASCII mode, instead of the default binary mode.

 

/MCopy only those files with the archive attribute set, i.e., those which have been modified since the last backup. The archive attribute of the source file will not be cleared after copying; to clear it use the /X switch, or use ATTRIB. Do not use /M with @file lists. See @file lists for details.

 

/NDo everything except actually perform the copy. This option is useful for testing the result of a complex SYNC command. /N displays how many files would be copied. /N does not prevent creation of destination subdirectories when it is used with /S.

 

A /N with one of the following arguments has an alternate meaning:

 

dSkip hidden directories (when used with /S)
eDon't display errors
jSkip junctions (when used with /S)
sDon't display the summary
tDon't update the CD / CDD extended directory search database (JPSTREE.IDX)

 

/PAsk the user to confirm each source file. Your options at the prompt are explained in detail under Page and File Prompts. See also: the /Q option below.

 

/QDon't display filenames, percentage copied, total number of files copied, etc... When used in combination with the /P option above, it will prompt for filenames but will not display the totals. This option is most often used in batch files. See also /T.

 

/RPrompt the user before overwriting an existing file. Your options at the prompt are explained in detail under Page and File Prompts.

 

/SCopy the subdirectory tree starting with the files in the source directory plus each subdirectory below that. If the destination subdirectories don't exist, SYNC will attempt to create them. If SYNC /S creates one or more destination directories, they will be added automatically to the extended directory search database.

 

       If you attempt to use SYNC /S to copy a subdirectory tree into part of itself, SYNC will detect the resulting infinite loop, display an error message and exit. Do not use /S with @file lists. See @file lists for details.

 

       If you specify a number after the /S, SYNC will limit the subdirectory recursion to that number.  For example, if you have a directory tree "\a\b\c\d\e", /S2 will only affect the "a", "b", and "c" directories.

 

/TTurns off  the display of filenames, like /Q, but does display the total number of files copied.

 

/VVerify each disk write by performing a true byte-by-byte comparison between the source and the newly-created target file. This option will significantly increase the time necessary to complete a SYNC command.

 

/WDelete files in dir2 that do not exist in dir1.

 

/XClear the archive attribute from the source file after a successful copy.

 

Topic "sync.htm" last edited 5/12/2008. ©2008  JP Software, Inc.
Keywords: SYNC