I want to apply a function, of Python, to all files in sub-directories of a given directory.
In bash, .sh
file, I list all files like so:
dir_list=()
while IFS= read -d $'\0' -r file ; do
dir_list=("${dir_list[@]}" "$file")
done < <(find give_directory_Here -mindepth 2 -maxdepth 2 -type d -print0)
However, there are some directories with a pattern, lets say the pattern is unwanted_pattern
, in their name that I want to remove from dir_list
.
How can I do that?
I tried things in here which did not work for me: solution 1 from stack over flow or solution 2 from stack exchange, so on!