cmd:mirrordir 

Basic Info 

Usage 

Info 

copydir, mirrordir - copy, mirror directory trees via a minimal set of changes, locally or over FTP, or over a secure tcp connection.

Description 

mirrordir is a set of useful utilities for manipulating and mirroring directories. Included is also the command pslogin - an alternative to ssh(1), and forward(1) for forwarding arbitrary TCP socket connections over encrypted secure channels.

Comments 

Help 

Detail Help 

mirrordir forces mirror to be an exact replica of the directory tree control in every possible detail suitable for purposes of timed backup. It naturally descends into subdirectories to all their depths. mirrordir tries to be as efficient as possible by making the minimal set of changes necessary to mirror the directory:

mirrordir copies files that are different between the directories control and mirror to the directory mirror. Files whose modification times or sizes differ are copied. File permissions, ownerships, modification times, access times (only if —access-times is used), sticky bits, and device types are duplicated. Symlinks are duplicated without any translation. Symlink modification and access times (of the symlink itself, not the file it points to) are not preserved. Hard linked files are merely copied. Creation times cannot be set with Unix as far as I can see.

mirrordir is a DANGEROUS command because files or directories that exist in mirror that don't exist in control are deleted. If mirror is entirely empty, then all files and directories in control will be copied.

Trying History 

recursdir 

$ recursdir unfinished/ -C 'if (!glob ("finished", FILE)) printf ("%s\n", PATH);'
unfinished/1076294450/finished
unfinished/1076294455/finished
unfinished/1076294477/finished
unfinished/1076294529/finished
unfinished/1076294594/finished
unfinished/1076295039/finished
unfinished/1076295052/finished
unfinished/1076295060/finished
unfinished/1076295063/finished
unfinished/1076295069/finished
unfinished/1076295077/finished
unfinished/1076295089/finished
$ recursdir unfinished/ -C 'if (glob ("finished", FILE)) printf ("%s\n", PATH);'
unfinished/
unfinished/1076294450
unfinished/1076294450/subject
unfinished/1076294455
unfinished/1076294455/subject
unfinished/1076294477
unfinished/1076294477/subject
[...]
unfinished/1076295089
unfinished/1076295089/subject
unfinished/1076295094
unfinished/1076295094/subject
unfinished/1076295094/part.1

The scripting language itself is a subset of the full C programming language. For example, the following is a valid script:

/* PATH is the full name of the file including
   its path, DIR is the directory, excluding
   the trailing slash (/), CWD is the current
   directory, and depth() returns the number
   of forward slashes (/) less one. */
if (depth (DIR) - depth (CWD) > 3) {
    printf ("%s: excluded\n", PATH);
    return EXCLUDE;
} else
    return INCLUDE;
$ recursdir . -C 'if (!glob ("finished", FILE)) printf ("%s\n", DIR);'
Segmentation fault (core dumped)

— add trailing '/' to '.' will be ok

Version 0.10.49 

Installation 

rpmih mirrordir-0.10.49-6mdk.i586.rpm libmirrordirz1-0.10.49-6mdk.i586.rpm libdiffie1-0.10.49-6mdk.i586.rpm

documented on: 2004.02.20 Fri