Search for contents of directory and copy

Right now I use the find command. I was wondering if there is a way to meet the following condition.

  1. Search for directories that contain the extension *.dbf.
  2. When the directories are found copy all of the contents into another directory, "Result".
  3. It would be copied into a directory called the "Result". All the files in the located directory would be contained under the "Result" directory using its original directory name.
    Bob

You could try something like (filter)

type=folder
contains
type=
*.dbf

and copy those results to a collection COPY to coll://Result

"contains" in a filter is for searching (text) file contents. It doesn't do anything with folders.

You'd probably need a script to go from the found files to copying the folders those files were found in. (At least in a way which avoids copying the same folder twice if two files are found in the same place.)

Actually, I would want every folder that contains the value. The values I'm looking for have accumulated over the years. I have to take every occurrence of the folder and save it so I can evaluated each and every folder that has the values I'm looking for.

Bob

You could try the button linked at the end of this thread, it will select all folders containing a specific filetype: Label filters, how to higlight folders containing PDFs
Some minor adjustments may be needed to meet your expectations (maybe to not show the popup wich asks for the extension).
After that run the COPY command to copy the selected folders into your "Result" folder/collection.