Find the answer to your Linux question:
Results 1 to 10 of 10
I am trying to find a way to search for specific folders that may reside in multiple locations. I have 92 dss partitions, (we store studies in this way / ...
  1. #1
    Just Joined!
    Join Date
    Jan 2008
    Posts
    6

    Search function

    I am trying to find a way to search for specific folders that may reside in multiple locations. I have 92 dss partitions, (we store studies in this way / 12/11/13/13/10/(study I want is here)) in this location would be a CT study someone had done, they may also have other studies done which could be stored in other dss partitions (under the same path) How do I do a recursive search for a folder? THis is how I look now

    find /opt/emageon/archive/dicom/dss*/files/10/11/12/13/14

    or

    cd /opt/emageon/archive/dicom/dss*/files/10/11/12/13/14

    This works for the first study.

  2. #2
    Linux Engineer wje_lf's Avatar
    Join Date
    Sep 2007
    Location
    Mariposa
    Posts
    1,192
    Various solutions to a question amazingly like this one have been posted here.
    --
    Bill

    Old age and treachery will overcome youth and skill.

  3. #3
    Just Joined!
    Join Date
    Jan 2008
    Posts
    6
    Problem is for that I was searching for a specific file, this is folder or multiple folders which could be on different dss partitions.

  4. #4
    Linux Engineer wje_lf's Avatar
    Join Date
    Sep 2007
    Location
    Mariposa
    Posts
    1,192
    Good point. There are two differences in the two questions, right?
    1. This time you want all the qualifying entries, not just one.
    2. This time you want directories "folders", not files.

    Know that the find command doesn't stop when it finds one qualifying entry; it goes for all them.

    And the
    Code:
    -type f
    in the other find command says, "Restrict your results to plain, regular files, and don't include directories." If now you're looking for "folders" (which means directories", use
    Code:
    -type d
    instead. If you're looking for either one, leave this option out entirely.

    Does this give you what you need?
    --
    Bill

    Old age and treachery will overcome youth and skill.

  5. #5
    Just Joined!
    Join Date
    Jan 2008
    Posts
    6
    So what you are saying is that if I am looking for any study done for patient id of 12/13/14/15/16 I could type this:

    find . -type d /opt/emageon/archive/dicom/dss*/files/12/13/14/15/16/

  6. #6
    Linux Engineer wje_lf's Avatar
    Join Date
    Sep 2007
    Location
    Mariposa
    Posts
    1,192
    The closer I look at this, the more questions I have.

    Let's just take one of them, because the rest of the discourse depends on the answer to it.

    In your example, I know that the "12/13/14/15/16" is a patient number, but:
    1. Is 12 a directory?
    2. Is 12/13 also a directory?
    3. Is 12/13/14 also a directory?
    4. Is 12/13/14/15 also a directory?

    Or is "12/13/14/15/16" supposed to be the name of a single directory?

    If this last is the case, then there will be problems. As far as I know, the bash shell is pretty much committed to the idea that "/" is the divider between levels of directory.
    --
    Bill

    Old age and treachery will overcome youth and skill.

  7. #7
    Just Joined!
    Join Date
    Jan 2008
    Posts
    6
    That is correct, 12/13/14/15/16 are directories. The way a study is stored, or should I say a typical path for a given study which is stored is this

    dss54/files/12/13/14/15/16/This is where the study is stored.

    I am looking for the study but I do not know the name of the directory the study is ultimately in. I know the patient ID and that is the only known information. (that is the 12/13/14/15, this is really his ID 12131415) For instance today, our long term storage was down, tsm was available, I used this to find the location of the study so I could pull the study for the surgeon.

    cd /opt/emageon/archive/dicom/dss*/files/10/11/12/13/14

    I was lucky in that the patient only had 1 study.

    What if the patient had 3 studies all on different dss partitions. For example: here is what it would look like:

    dss25/files/12/13/14/15/16/study 1
    dss54/files/12/13/14/15/16/study 2
    dss90/files/12/13/14/15/16/study 3

  8. #8
    Linux Engineer wje_lf's Avatar
    Join Date
    Sep 2007
    Location
    Mariposa
    Posts
    1,192
    Actually, you gave me the answer I was hoping for.

    And here is what you do. Don't bother with find; in this case that's far too slow.

    To get a list of all studies for a particular patient, one study per line, do this:
    Code:
    ls -1 /opt/emageon/archive/dicom/dss*/files/12/13/14/15/16/*
    #   ^ that's a one, not an ell
    To get a list of all studies all on one line, do this:
    Code:
    echo /opt/emageon/archive/dicom/dss*/files/12/13/14/15/16/*
    Simple as that.
    --
    Bill

    Old age and treachery will overcome youth and skill.

  9. #9
    Just Joined!
    Join Date
    Jan 2008
    Posts
    6
    Thank you very much. I will test this in the morning.

  10. #10
    Just Joined!
    Join Date
    Jan 2008
    Posts
    6
    That worked perfect. I was able to find any study stored for a single patient in any dss partition. Thank you very much!

Posting Permissions

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