I have a hierarchy of directories. Some directories do not contain files and they only contain other directories. Some contain files.
For example:
- movies
- 2022
- action
- movie.mp4
- another-movie.mp4
- 2023
- drama
- movie2.mp4
- 2024
- thriller
- movie3.mp4
- movie4.mp4
I want a find
command that would provide this result:
/movies/2022/action
/movies/2023/drama
/movies/2024
/movies/2024/thriller
I read this and this and this, but I could not figure out a find
command.
Update: A directory can have files and directories in it. I updated the question. For example in the 2024
I have a movie and another directory. The result should contain both /movies/2024
and /movies/2024/thriller
directories.
find
with different capabilities so we need to know what you are working with . – terdon Oct 15 '23 at 11:21