Florian Philipp writes:

> Use `truncate -s <size> <file>`
> 
> It creates a sparse file if the specified file is smaller than the
> specified size. It will also create a new file if it does not yet exist.

Nice one. First I did not see an improvement over using dd to create the 
sparse file, but in combination with cp --attributes-only I can now 
duplicate the file with its attributes but zero size, and then fake the 
size.

> In order to avoid trouble with line breaks in names, I recommend
> something like:
> find . -type f -print0 |
> while read -d $'\0' file; do
>       echo "File=$file"
> done

Thanks!


> For copying file attributes from one file to another you can use `cp
> --attributes-only`.

Oh my, another case of a (german) man page that does not show all the 
possible arguments. Never heard about that, thanks!

        Wonko

Reply via email to