I would like to calculate the size of a directory tree I am going to compress for archiving. I can't for the life of me figure out/feel how the word splitting or command substitution (which I've tried using to remedy the problem) in bash is functioning.
I want to exclude several directories. I place the arguments, which will also be passed to tar in the same manner, in a variable:
exclude_opts="--exclude='VirtualBox VMs/Windows 7/*' --exclude='Software/*' --exclude='LSTC/*'"
I then reference this in my call to du
$ du -sb $HOME $exclude_opts 38711578819 /home/patrick du: cannot access `VMs/Windows': No such file or directory du: cannot access `7/*"': No such file or directory 38711578819 total
$exclude_opts is being word split for some reason. How do I fix this? All my attempts have failed.
I would like to do this from within the same file; no