Is there a way to exclude certain directories?

Is there a way to exclude certain directories?

For example, my file structure looks a bit like this: 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: but can’t seem to figure it out.

How to exclude a file from the find command?

” findme “: The test file in all directories. We can exclude directories by using the help of “ path “, “ prune “, “ o ” and “ print ” switches with find command. The directory “bit” will be excluded from the find search!

Why do I need to exclude uploads from my file structure?

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: 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.

How to use du-Ch-exclude on macOS?

If you have to be on macOS, you install GNU Coreutils with the following command. Most of the commands installed by Coreutils are prefixed by g, since they have a BSD namesake preinstalled on macOS. Then you can do the following. du -ch –exclude= {path/to/folder1,path/to_folder2/,…,}

How to exclude multiple directories on a Mac?

Note no asterisk at the end. The asterisk means all subdirectories under “upload” should be omitted – but not the files directly in that directory. To exclude multiple directories, just pass the –exclude flag again. If you have to be on macOS, you install GNU Coreutils with the following command.

How to exclude multiple folders in a list?

Note: If you want your $Excludes to be case-sensitive, there are two steps: Remove the Exclude parameter from Get-ChildItem. Note: This code has redundancy that I would never implement in production. You should simplify this quite a bit to fit your exact needs. It serves well as a verbose example.