Let say we have
Scripts
Test
Test1
When we do ls
it shows all the three directories but I need to exclude the test1
.
So I should get only
Scripts
Test
What command should I use here to exclude a directory?
Thanks in advance
Go to Start > Settings > Update & Security > Windows Security > Virus & threat protection. Under Virus & threat protection settings, select Manage settings, and then under Exclusions, select Add or remove exclusions. Select Add an exclusion, and then select from files, folders, file types, or process.
To exclude multiple directories, OR them between parentheses. And, to exclude directories with a specific name at any level, use the -name primary instead of -path .
tree displays the directory structure of the current directory. -d option displays only directories. -I option allows to exclude directories that match specific pattern e.g. In order to exclude multiple directories at once, their names must be separated by | sign, i.e.
Exclude Files and Directories from a List. When you need to exclude a large number of different files and directories, you can use the rsync --exclude-from flag. To do so, create a text file with the name of the files and directories you want to exclude. Then, pass the name of the file to the --exlude-from option.
ls -ITest1
from man ls
:
-I, --ignore=PATTERN
do not list implied entries matching shell PATTERN
You can use it multiple times like:
ls -ITest1 -ITest2
or you could use a matching pattern:
ls -ITest?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With