Friday, 15 January 2010

text - Terminal command 'find' read from txt files -



text - Terminal command 'find' read from txt files -

i find .html files directory ignore files.

$ find /volumes/workspace/myproject/ -name '*.html' ! -name 'myfile.html'

above command ignore myfile.html only. have lists of files ignore , wanna maintain ignore file in single txt file.

myfile1.html myfile1.html myfile2.html myfile2.html

above txt file content.

i have list of files ignored maintain in single txt files , utilize txt file in find command.

please advice. in advance.

you have build array file , utilize in find syntax. i.e.

#!/bin/bash while ifs= read -r file; arr+=(-name "$file" -o) done < list_of_filenames_to_omit.txt #remove trailing -o unset arr[$((${#arr[@]}-1))] if ((${#arr[@]}!=0)); find /volumes/workspace/myproject/ -name '*.html' ! \( "${arr[@]}" \) else #list_of_filenames_to_omit.txt empty find /volumes/workspace/myproject/ -name '*.html' fi

text terminal find command

No comments:

Post a Comment