hello.
I try to print a list of files but excluding some directories and some files.
I would like to write a command for :
find "from_dir" "ignore dir1, dir2, ..." "ignore file1, file2,...." "where file are older than 2017-02-03T06:00:00"
Note that "DO_IT" is a local function in the script and is exported like this
function DO_IT () {
MY_PATH1="$1"
if [[ ! -d "$MY_PATH1" ]] ; then
echo "doing : $MY_PATH1"
fi
}
export -f DO_IT
what does CHERCHE "$0" do to the files in question?
find executes actions if the test's result is TRUE. -o will add TRUE results, not remove any from before. So, to exclude some files, this might not be the desired operator?
What the script does is hard to see. But.
Consider that sometimes using a tool for a complex task sometimes requires other tools.
As a template:
find path1 path2 path3 | grep -v '^\.*'
Which removes so-called hidden files - ones starting the dot character. They are hidden because the default for ls is not to display them. ls -a will display them.
If you have a "crazy" list of filenames to ignore - one that has too many names - use a pattern file with grep.