Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I have close to hundreds of .fastq files in different subfolders under a shared drive along with many big files such as .bam files. I want to copy only the .fastq files to another location in a same folder to perform an analysis. How can I do it on a Mac? I tried:

find -E . -iregex '.*/*\.fastq'

which showed all the files along with the relative path, but I don't need the path. And I cannot figure out a pipeline to copy them to another location.

share|improve this question

migrated from stackoverflow.com Apr 2 '13 at 18:30

This question came from our site for professional and enthusiast programmers.

1 Answer 1

up vote 3 down vote accepted

You don't need to use regexes if you're just looking for files with a particular extension.

find . -name '*.fastq' -exec mv {} /new/dir/ \;
share|improve this answer
    
Thank you very much. It works perfectly. –  user2237343 Apr 2 '13 at 18:42

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.