1 |
Florian Philipp writes: |
2 |
|
3 |
> Use `truncate -s <size> <file>` |
4 |
> |
5 |
> It creates a sparse file if the specified file is smaller than the |
6 |
> specified size. It will also create a new file if it does not yet exist. |
7 |
|
8 |
Nice one. First I did not see an improvement over using dd to create the |
9 |
sparse file, but in combination with cp --attributes-only I can now |
10 |
duplicate the file with its attributes but zero size, and then fake the |
11 |
size. |
12 |
|
13 |
> In order to avoid trouble with line breaks in names, I recommend |
14 |
> something like: |
15 |
> find . -type f -print0 | |
16 |
> while read -d $'\0' file; do |
17 |
> echo "File=$file" |
18 |
> done |
19 |
|
20 |
Thanks! |
21 |
|
22 |
|
23 |
> For copying file attributes from one file to another you can use `cp |
24 |
> --attributes-only`. |
25 |
|
26 |
Oh my, another case of a (german) man page that does not show all the |
27 |
possible arguments. Never heard about that, thanks! |
28 |
|
29 |
Wonko |