I'm writing a script in which I need to generate a tree of directories.
How to pass to tree
a variable with list of directories to ignore? And those directories are with spaces in name.
I tried something like this:
tree -o /volume1/web/eb.html -T "List" --charset UTF-8 -C -I "$to_ignore" -P '*pdf' --prune --noreport /volume1/docs
Where vaiable to_ignore
is a list of directories generated somewhere else by script:
'dir1|dir2|dir with space|dir4'
but that didn't worked. It crashed on dir with space.
Ok, so using quotes around variable helped with crashes but then tree
prints even those directories that have required pdf files and are on list to ignore. And what's strange if I write those directories to ignore directly in my tree ...
command than it works fine.
tree
returns directories that have required pdf files even if they are on list of directories to ignore – Michał Mietłowski Jul 13 '15 at 11:25