I can not make this simple script work in bash
# Works
for f in *; do
for j in $f/Attachments/*.pdf; do
echo "$j"
done;
done
# Doesn't work
for f in *; do
for j in $f/Attachments/*.pdf; do
if [ ! pdfinfo "$j" &> /dev/null ]; then
echo "$j"
fi
done;
done
I have read 10+ guides, and I cannot understand why this script lists a bunch of random directories.
It should:
- List folders in the current directory
- In each folder it should list all PDF-files in the subdirectory Attachments
- For each file it should check if it is corrupt, and if so print it