I have a number of files that are saved as
Year -> Month -> Day -> bunch of .nc files
I would like to generate a list of all of the directories that contain the nc files. I can list the path of each nc file with:
find /Year/ -name *.nc | sort > directory_list.txt
which finds each .nc file in the sub directories of these folder in this main file. These results are then saved in a text file 'directory_lists'.
/2000/01/01/nc_file1.nc /2000/01/01/nc_file2.nc /2000/01/01/nc_file3.nc /2000/01/02/nc_file3.nc /2000/01/03/nc_file3.nc
and so on... How is it possible to slightly modify this so that I have a list of each 'Day' directory? This would be similar to the results I get with the command above, but without the information on the nc file included.
I have tried:
find /Year/ | sort > directory_list.txt
but this returns each path
/Year/ /Year/Month /Year/Month/Day
I would like the outcome to be:
/2000/01/01/ /2000/01/02/ /2000/01/03/
and so on... without the directory name being repeated
I think this is the same as trying to get the directory of the third level folder within the Year directory? Any advice would be appreciated.