As part of a backup script I want to find the total GB of a list of files to be backed up to see if the supplied USB stick is big enough.
The ideal command is
du, for example:
[email protected]:~$ du -sch Documents Desktop Pictures2.4G Documents
73M Desktop
1.9G Pictures
4.4G total
[email protected]:~$ Better still,
du has an option to read the file list from a file:
--files0-from=<file-list-path>but the listed file/directory names must be NUL-terminated, and this is where I have become stuck.
A web search indicates "\0" as a null character but adding printf "\0" after a name when creating the file-list does not work, and I've tried many other variations offered on the web.
I would be grateful if anyone can suggest a way of listing files/directories in a file so that
du will read it.