As simple and naïve as it sounds, I'm struggling with the find
and file
command. I use -exec file
because the specific files I need to obtain do not have their extension name in the filename, which eliminates the possiblity of the -name
option in find
. See my find
command and workspace below:
My Current Code:
workspace=/PATH/
### --- Example hierarchy of where all the files needed are located recursively:
##### -----("$workspace"/ID/ID/DICOM/cat)
####### ------- 'cat' is a .dcm file, without ".dcm" in its name
PETS=`find . -type f -exec file {} \; | grep "DICOM"`
My current output, which looks like a typical output for find
:
./PATH/ID/ID/DICOM/cat: DICOM medical imaging data
(1)
By default, I would've done this to assign it to a variable:
PETS=($(find . -type f -exec file {} \; | grep "DICOM"))
However, I only get the first instance through this output (when there are many other DICOM files located in relation to the working directory), which almost is a truncated version of my current output above in (1)
./PATH/ID/ID/DICOM/cat:
(2)
How do I actually obtain the files themselves from (1) or (2), or from a modification of my find
command, so I can feed it into the dcmdump
utility from the dctmk Toolbox?