This is probably something basic but I'm not able to make it work. I'm trying to use DU to get a total size of files minus certain directories. I need to exclude one specific directory called uploads
but not every directory called uploads
. For example, my file structure looks a bit like this:
/store
/uploads
/junk_to_ignore
/more_junk_to_ignore
/user_one
/uploads
/user_two
I can run the following command:
du -ch --exclude=uploads*
and it gives me the file size minus all the "uploads" directories. However, in trying to exclude certain directories (and all its sub-directories) I fail. I've tried variations of:
du -ch --exclude=./uploads*
du -ch --exclude='/full/path/to/uploads/*'
but can't seem to figure it out. How do I exclude a specific directory?
username: store$ du -ch --exclude=./uploads
worked (with and without the wildcard) for me, from within the store directory. Are you running that command exactly and from within the store folder? And it has to be the relative path (that find sees/prints), not absolute.