Okay, I think this is possible, but I can't quite figure it out. This is the situation. A folder contains the log files of all the processes on my robot. The structure looks sort of like this: ``` $ ls -lrt total 8 drwxrwxr-x 2 per per 4096 nov 3 12:46 launch01 -rw-rw-r-- 1 per per 0 nov 3 12:47 camera112.log -rw-rw-r-- 1 per per 0 nov 3 12:47 motors121.log -rw-rw-r-- 1 per per 0 nov 3 12:47 lidar111.log drwxrwxr-x 2 per per 4096 nov 3 12:49 launch02 -rw-rw-r-- 1 per per 0 nov 3 12:49 motors122.log -rw-rw-r-- 1 per per 0 nov 3 12:49 lidar211.log -rw-rw-r-- 1 per per 0 nov 3 12:49 camera113.log ``` The files `camera112.log`, `motors121.log` and `lidar111.log` are associated to the logs in folder `launch01`. I would like to write a script that gets all the files that belong to a specific launch and tar them into one tarball. Since timestamps can change between slightly by files and the numbers in the files are only nearly related, I think the best way to gather all relevant files is to get all files which are below `launch01` (inclusive), up to the next directory in the list (exclusive). The number of files can vary, as can the time stamps and names. What is consistent is the folder, then a bunch of files, then the next folder, then files, etc. Ultimately, I would like to get the latest set of logs easily. Unsure of the approach here. Any ideas how to go about this? Clarifications: - Number of files can vary. - The exact timestamp is not reliable (as above, the folder `launch01` is different than `camera112.log`) but relative timestamps work fine. For instance, if I could tar all files from `launch01` (inclusive) to `launch02` (exclusive) in the list provided by `ls -lrt`, that works great.