Find the answer to your Linux question:
Results 1 to 2 of 2
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1

    Searching for non-exisitent files

    My question is for bash scripting...

    I have a path to a certain directory GGG and within GGG are a random amount of subdirectories and the number of directories can change. Each of these random directories are supposed to have the exact same file ZZZ.jpg.

    I can easily return the path using locate or find when the file ZZZ.jpg exists, but I want to also return the path up to where the file would have existed. Basically I want the path when ZZZ.jph does not exist.

    /GGG/HHH/ZZZ.jpg (This is no problem)
    /GGG/III/ (No file - I want path up to and including III.

    Thank you

  2. #2
    Linux User
    Join Date
    Jun 2012
    SF Bay area
    Try this...

    find GGG -type d ! -exec test -f "{}/ZZZ.jpg" \;  -print

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts