Hello everyone,
I need to make a task automated using scripting.
I need to search for a file named ".archlock" in all the subdirectories of a directory up to infinite level and then create a file if it does not exist.
until now, I did the following.
1. ls -l|grep ^d | wc -l --> returns number of sub directories in that directory.
2. ls -ltr /*.arch* | wc -l --> verifies how number of sub-dir have that file
3. if the count of step 1 and 2 are not same, I used to go to the individual directory and see if the file exist.
Clearly there must a much better way using scripting, please help.
Thank you,
Himalay
I need to make a task automated using scripting.
I need to search for a file named ".archlock" in all the subdirectories of a directory up to infinite level and then create a file if it does not exist.
until now, I did the following.
1. ls -l|grep ^d | wc -l --> returns number of sub directories in that directory.
2. ls -ltr /*.arch* | wc -l --> verifies how number of sub-dir have that file
3. if the count of step 1 and 2 are not same, I used to go to the individual directory and see if the file exist.
Clearly there must a much better way using scripting, please help.
Thank you,
Himalay