-1

I want to loop over files matching *.pdf, in the directories matching [A-J]*?

I don't understand what is unclear about this question that resulted in putting it on hold.

closed as unclear what you're asking by dr01, cuonglm, roaima, Bananguin, don_crissti Nov 13 '15 at 12:15

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • 1
    Great. What have you tried so far? – roaima Nov 13 '15 at 11:08
4
for file in [A-J]*/*.pdf ; do
    : # do something with "$file" here
done
  • I see the intuition behind this, but it doesn't work in my case. If, say, "do something" is echo $file, it prints [A-J]*/*.pdf – Erwann Nov 13 '15 at 21:00
  • I may have to do with the whitespaces in the directory, as the proposed solution works with a test case not involving whitespaces. – Erwann Nov 13 '15 at 21:11
  • @don_crissti, no I don't see what was unclear about my initial question. – Erwann Nov 13 '15 at 21:17
  • @don_crissti, how could an answer be "perfectly fine" if the question is ill posed, as you claim? (rhetorical) And yes, cas' answer is spot on, and that ends the matter for me. Thanks. – Erwann Nov 13 '15 at 21:39
  • In fact, I quoted "$file" in the comment. That was quite deliberate. I meant do something with "$file" here, not do something with $file here. And, no, it won't print the literal string [A-J]*/*.pdf unless that glob doesn't match any files...which contradicts your original question. – cas Nov 13 '15 at 22:47

Not the answer you're looking for? Browse other questions tagged or ask your own question.