I have a list of directories in a file:
Code:
/root
/boot
/sys
/a_dir
/b_dir
I want to remove already existing directories from this list:
How can I do this? I know xargs can deal with one line at a time and [ -d dirname ] will show if the dirname is present. So I tried:
Code:
cat dirlist | xargs -I {} [ -d {} ]
but it does not work. Thanks for your help.