Thursday, September 27, 2012

Bash process find result

find . -name '*.txt' | while read line; do
    echo "Processing file '$line'"
done

e.g.
find . -name '*T&C*.pdf' | while read orig_file do 
  new_file=`echo $orig_file | sed 's/[/]/_/g'`
  cp $orig_file $new_file 
done

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.