Hi, I have a problem I am trying to solve with bash.
I need to search in a file system (data base) with hundreds of directories and thousands of subdirectories and millions of files. The files have a specific format with a header that gives the properties. Directories are organized so subdirectores have some identical header properties, thus you can rule out a whole directory by testing a single file.
My plan was to get one file from every single subdirectory and test its header. However I can't think of a neat way to do it. The bash command DIRS=`find . -mindepth 3 -maxdepth 3 -type d` and then looping over $DIRS with the ls command is effective but requires an ls command on every single subdirectory..
I was wondering if there is a way to pick any file from $DIR without doing the ls?
Thanks!