file & dir ownership & permissions

Giorgos Keramidas keramida at
Thu Apr 10 03:28:50 PDT 2003

On 2003-04-10 01:13, "Jay J Liew (20004)" <jliew1 at> wrote:
> Is there some kind of system maintainance tool that saves file and
> directory ownership and permissions? Technically, it'd be a proper
> subset of GNU tar since GNU tar not only ``tars'' into a tarball but
> it also preserves the ownership and permission structure on all files
> and directories. Please cc: Thanks.

Have a look at mtree(8).  Here's the output of running it on a test

    giorgos at gothmog[13:17]/tmp/alpha$ mtree -c > /tmp/spec.alpha
    giorgos at gothmog[13:17]/tmp/alpha$ cd ..
    giorgos at gothmog[13:17]/tmp$ mkdir beta
    giorgos at gothmog[13:17]/tmp$ cd beta
    giorgos at gothmog[13:17]/tmp/beta$ mtree -eU < /tmp/spec.alpha
    . changed
            modification time expected Thu Apr 10 13:17:10 2003 found Thu Apr 10 13:17:57 2003
    giorgos at gothmog[13:18]/tmp/beta$ ls
    giorgos at gothmog[13:18]/tmp/beta$ cat /tmp/spec.alpha
    #          user: giorgos
    #       machine:
    #          tree: /tmp/alpha
    #          date: Thu Apr 10 13:17:53 2003

    # .
    .               type=dir uid=1001 mode=0775 nlink=2 size=512 \
                    time=1049969830.0 flags=none

    giorgos at gothmog[13:18]/tmp/beta$

More information about the freebsd-questions mailing list