learingperl01
MIS
Hello everyone,
Hoping someone could point me in the right direction. I am trying to write a script that will process files on the newest/latest created directory. I have a script that will process a directory based on an argument that is passed against. Since a new directory is created every so often I thought the best way to go about this would be to have the script run against the last directory that was created. I am not sure what the best way would be to go about this is? One way that I was thinking of doing it was by running a system command of "ls -tr $DIR_PATH |tail -n 1" but I know there is a a better way to do this. What is the best way to monitor a directory for new directories being created?
Just as an example: I would be monitoring the /user01/mon_dir directory once I see a new directory is created within mon_dir I would like to process that directory.
thanks for the help.
Hoping someone could point me in the right direction. I am trying to write a script that will process files on the newest/latest created directory. I have a script that will process a directory based on an argument that is passed against. Since a new directory is created every so often I thought the best way to go about this would be to have the script run against the last directory that was created. I am not sure what the best way would be to go about this is? One way that I was thinking of doing it was by running a system command of "ls -tr $DIR_PATH |tail -n 1" but I know there is a a better way to do this. What is the best way to monitor a directory for new directories being created?
Just as an example: I would be monitoring the /user01/mon_dir directory once I see a new directory is created within mon_dir I would like to process that directory.
thanks for the help.