After performing a shell script, a new directory is created and I need to work with that directory, but I don’t know the name.
How can I get the name of the most recent directory created?
The name will be formatted like 2022-12-01_1702, so the directory I need will be the last if sorted alphanumerically, if that helps.
I found resources for looking at files, but not directories. If it’s necessary to find this directory based on the creation date of its contents, there are files located at [dirname]/Databases/Filename.xxx
Is it the shell script also be triggered via ansible? If yes then you can register the path and work with it later. If not then do you know roughly when script be triggered then can just use shell command to find the directory with created date.
I don’t think you can achieve what you want if the file keep generating. Ansible is not real time monitor/scanning. The most recently at the point of time when you trigger only.