I would like to write a shell script in order to write all files ending with .tif in a given directory and all its subdirectories to a csv file.
The directory contains various sub-directories and those can also contain .zip folders so the script should be able to extract the names from zip folders too.
I first thought about separating these steps though (unzipping and getting the filenames) but I'm not sure if this is really necessary.
Since I'm really new to working with the Shell, any help would be appreciated.
Best Answer
To search for
.tif
files inside a folder and its subfolders, then write the output in a.csv
file you can use the following command:To search also inside
.zip
files and append the output to the previoustif_filenames.csv
file you can use:where
process
is the following bash function:Source: https://unix.stackexchange.com/a/12048/37944