Issue
I have a directory that looks like this
dir
|--folder1
| |--- subfolder1
| |--- ...
| |--- subfolder100
|
|--folder2
|--- subfolder1
|--- ...
|--- subfolder100
Each folder and subfolder contains among others files with the extension ".fq.gz"
I want to list all files with a .fq.gz
question , and copy their filenames
and file size
in a .txt
file.
I want something like this.
While I know how to copy the file names
ls -R | grep "\.fq.gz" > ${destination}output.txt
it becomes rather complicated to add the file size. I am taking an error that the file does not exist
I want something like this
less data.txt
file1.fq.gz 43434343
file2.fq.gz 43454854
....
Solution
With GNU find:
find . -name '*.fq.gz' -printf '%f %s\n'
Answered By - oguz ismail Answer Checked By - David Marino (WPSolving Volunteer)