I am trying to create a folder structure for audit logs that gets generated by the AIX system and Database
Below is a simple example of a file in a folder:
ls -l /opt/audit/move/
Output:
-rw-r--r-- 1 gl_user user 0 18 Aug 2019 test1.txt
-rw-r--r-- 1 gl_user user 0 06 Nov 18:55 test2.txt
The problem with the above ls -l command is that recent files in column 8 displays time instead of the year. I could of used awk and a for loop to get the month and year for the file, but this is not an option as seen above
The idea is to move the files in the below folder structure:
# ls -l /opt/audit/2019/August/test1.txt
-rw-r--r-- 1 gl_user user 0 18 Aug 2019 test1.txt
# ls -l /opt/audit/2022/November/test2.txt
-rw-r--r-- 1 gl_user user 0 06 Nov 18:55 test2.txt