3

I'm looking for a Linux equivalent of the command Robocopy /CREATE, which recreates a complete empty file tree with all the attributes of folders and files in the source, except the files' contents. Rsync, which is said to be the equivalent of Robocopy for general file synchronization purposes, doesn't seem to have a similar option.

I'm recovering data from a 4TB hard disk drive, with the main partition formatted in Ext4, so far I could clone 47% with HDDSuperClone until it started to suffer serious issues, but the partition is still not accessible on the recovery drive, while recovery softwares like R-Studio and DMDE can't reconstruct the original metadata structure, and the drive's current degraded condition may not allow to recover significantly more useful data.

So, since the original drive can still be mounted on Lubuntu (albeit with difficulty), if I have to resort to “raw file carving”, i.e. scan the recovered data with tools that detect file signatures and extract all detected files in bulk (I'm using mainly R-Studio and Photorec for that purpose), I'd like to at least provide the drive's owner with a way of sorting such a mess more conveniently than doing it from scratch with no reference.

Obviously, in such a context, the command I'm looking for should proceed quickly and only analyze a few key filesystem structures, not involve a thorough scan of the partition which would only wear out that drive further.

GabrielB
  • 893

1 Answers1

5

There is --attributes-only option for cp. It's not required by POSIX, so not every implementation of cp will understand it; still cp from GNU coreutils in your Lubuntu does support it.

--attributes-only
don't copy the file data, just the attributes

It creates files of size 0. To copy a directory tree you need -R, so

cp -R --attributes-only /path/to/mountpoint/ /where/to/copy/to