Reputation: 13
What im trying to do is something along the lines of(this is pseudocode):
for txt in $(some fancy command ./*.txt); do
some command here $txt
Upvotes: 1
Views: 5515
Reputation: 5932
Try
find . | grep ".txt" | xargs -I script.sh {}
find returns all files in the directory. grep selects only .txt files and xargs sends the file as Parameter to script.sh
Upvotes: 0
Reputation: 781761
Use the -exec
option to find
:
find /usr/share/wordlists/*/* -type f -name '*.txt' -exec yourScript {} \;
Upvotes: 0
Reputation: 123608
You can use find
:
find /path -type f -name "*.txt" | while read txt; do
echo "$txt"; # Do something else
done
Upvotes: 5