Etaoin Shrdlu writes:
> On Sat, 29 Jan 2011 15:27:59 +0100 Alex Schuster <[email protected]>
> wrote:
> > > > I just wrote a little script that does this, but it does not do the
> > > > sparse file thing yet, and would have problems with newline in file
> > > > names. And I guess someone already wrote such a utility?
> > >
> > > IIUC, try
> > >
> > > find / -type d -exec sh 'mkdir -p target"$1"' - {} \;
> >
> > Hmm, that does not really seem to work. It tries to execute the whole
> > stuff between single quotes as a command. And I don't really understand
> > what it is supposed to do, shouldn't this be something like mkdir -p
> > /destination/$1/\{\} ?
>
> No. That recreates the full directory hierarchy based at / under
> /target/, with no files in it. Just the directory hierarchy.
Ah, now I get it. There's a -c missing after the sh command.
> I should
> have added that, to do it safely, the target should reside higher than
> the source in the hierarchy, or it should be on a different filesystem
> and in that case -xdev should be specified to find (otherwise an
> recursive loop would result).
Right, but not important in my case. I want to mount my backup drive to
/mnt, cd /mnt, and duplicate all stuff soemwhere else, without taking up
much space. Then I can remove the backup drive and I only have to mount it
again when I need a file's content, but not for finding out which files
there are and how much space they take. Well, the space already is in the
file created by du -m, but I'd like to directly navigate around.
> Ok, I misunderstood. You also want the files but empty. Why do you need
> support for sparse files? Do you need to manage other types of file
> (symlinks, FIFOs, etc.)
Yes, symlinks would ne nice, too, I forgot about them. The rest is
unimportant, as this would be data only, not root file systems. I backup
that with rdiff-backup to a 2nd drive, but there's much other stuff that I
would like to put on one of the old drives that lie around here.
Sparse files would be nice because then I do not only have the same logical
structure, the files also appear to have the same size as the originals,
instead of having a size of 0. I could navigate and explore the directory
structure with mc, and with du --apparent-size I could find out how much
space a subdirectory takes. Again, my du -m file already has this
information, but while navigating in the directory tree, being able to use
du would be nice.
Wonko