# Copyright (c) 2005, Mike Harrelson # All rights reserved. # /* Copyright (C) 1997-2005 Mike Harrelson SyncDir is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. SyncDir is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. The GNU General Public License is often shipped with GNU software, and is generally kept in a file called COPYING or LICENSE. If you do not have a copy of the license, write to the Free Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. */ Syncdir 2.6.1 Usage: syncdir [-fmusqdicl] syncdir updates files and directories in to match what is in . Since this operation can be dangerous, syncdir normally prompts the user for verification. The following flags are defined: -f : Forces syncdir to bypass user verification and proceed directly with operations. Normally syncdir prompts to verify or confirm the operation with the user. -m : Tells syncdir that it is to mirror with exactly, thus making it an exact copy of . Anything in that is NOT in is deleted. Care should be taken when using this flag. -u : {default} Tells syncdir only to update files in with those in . Files in that are not in are preserved (unlike with the -m option). Also, for regular files, if the file in is "newer" than the version in , then it will NOT be updated. -s : Skip file system boundaries. Do not process source directories that reside on another file system. Only the directory itself will be sync'ed (permissions, ownership, etc), but not its contents. If this flag is specified, and a destination directory exists, then anything in the destination directory will be untouched. -q : Quiet mode. Do not print any progress output to stdout. Same as redirecting syncdir's processing output to /dev/null. -d : Show differences only. Do not make any changes to the filesystem. This option produces virtually the same output as if syncdir was run normally but does not really do anything. It is usefule for seeing changes to a filesystem before syncing them. -i : Include .snapshots directories which are normally excluded -c : Compare contents for regular files when timestamps and file sizes are the same. -l : If initial argument(s) are symlink(s), synchronize what they point to (aka follow) instead of treating them as symlinks. The -m and -u options should not be specified at the same time since they enable conflicting operation modes. Syncdir will use whichever one is specified last. Syncdir updates file and directory contents of so that they are in sync with those in . Affected are file contents, owner, group, permissions, and modify time. Syncdir can handle regular files, directories, symbolic links, character special files, block special files, named pipes (FIFOs), Unix sockets, and sparse files (regular files with space holes in them). Other files types like doors, etc. are not yet supported. File contents are only updated when the files' modification times or sizes are out of sync. Missing files, directores, links, etc. are duplicated if missing from . Since modification times are synchronized, successive runs of Syncdir on the same directories will only update anything in them if the modification times on those items have changed. Starting with version 2.5.9, Syncdir can now be run as a non-root user. However, ownership/group settings on objects may not be allowed if your OS does not support it. Also, certain special device files cannot be created without root priviledges. As of 2.6.1, hardlinks are not yet differentiated (planned for future release, maybe). Syncdir will NOT run if the effective UID is not the same as the real UID. Care should also be taken if the -l option is used. Verify the link targets before running syncdir. NOTE: It is possible for the owner of a file to set the modification time (and/or size) of a file in a way that can fool syncdir into thinking that it has not changed. The 'touch' program typically allows one to do this. Other programs, like tar, also usually set the modification time on objects. So much for security! In such cases -c must be used to force the contents to be compared for changes. Please e-mail comments, suggestions, bugs to mikeh@mindspring.com Last updated: 9/7/2005 These may or may not be implemented in future versions: 1. Handle hardlinks (detect and duplicate hardlinks) 2. Add exclusion handling (exclude specific files or directories) 3. Add ACL checking/synchroization