My data structure is something like:
dir1/subdir1_level1/subdir1_level2.../subdir1_leveln dir1/subdir2_level1/subdir2_level2.../subdir2_leveln ...
Which means that the levels I'm working with are not structured properly, nevertheless. I managed to accomplish my objective of getting the filename according to the first 2 levels of the path, and output them to a text file named dirn_subdirn_fname.txt with:
find dir1/subdir1 -type f -printf "%f\n">dir1_subdir1_fname.txt
But I was wondering if there was a way to Iterate this process across a list of several dir/subdir's
edit: I found a way to do the first part:
#!/bin/bash shopt -s dotglob nullglob topdir= './Dir1' for subdir in "$topdir"; do find "$subdir" -type f -printf "%f\n" done