Re: Difficult subdirectories check...



hotmail_spam@xxxxxxxxxxx (Martin Jørgensen) writes:

Hi,
-snip-

./check_graphics_inclusion (bash-script-filename):
------------------------------------------------

# This finds all graphic files:
for graphics_file in $( find . \( -iname "*.png" -or -iname "*.pdf" \) ); do

# So: Which files are included and which aren't?

for texfile in $(find . -name "*.tex"); do
grep -H -i "\includegraphics" ($i);

# how to extract the filename between braces { } ?

extracted_graphicsfile = { } awk/whatever ???

# if file exists (png/pdf) and it is *not* included in .tex-file -> print it
out.

if [ graphics_file != ??texfile?? ]

echo $(graphics_file)
done

# pseudo-code included above...

Why doesn't anyone have any comments? Can't it be done with a script?

Actually my suggestion is a little wrong... The first find . \( -iname
"*.png" -or -iname "*.pdf" \) should probably store the output in a list
or perhaps even better yet: To a temporary file.

The contents of this temporary file could probably then be grep'ped and
in case a match is found in the tex-file and in case that same match
isn't found in the temperorary file, then that should be printed out.

I would say the solution isn't far away... But I'm not the expert. New
suggestion:

-----------

find . \( -iname "*.png" -or -iname "*.pdf" \) > tmp.txt

for texfile in $(find . -name "*.tex"); do
grep -H -i "\includegraphics" ($i);

# extract the filename between braces - I don't know how to do it.


# if extracted file-name is not found in tmp.txt -> print it out.

-----

Is there more to it? I don't think actually, but I may be wrong if you
say so.


Best regards
Martin Jørgensen

--
---------------------------------------------------------------------------
Home of Martin Jørgensen - http://www.martinjoergensen.dk
.



Relevant Pages

  • Build Problem
    ... I set up a basic program per course instructions to simply create a ... Command Lines ... @echo off ...
    (alt.comp.lang.learn.c-cpp)
  • Build Problem
    ... I set up a basic program per course instructions to simply create a ... Command Lines ... @echo off ...
    (comp.lang.cpp)
  • Build Problem
    ... I set up a basic program per course instructions to simply create a ... Command Lines ... @echo off ...
    (microsoft.public.vc.mfc)