bash - Linux Find and execute -


i need write linux script following: finding .ear , .war files directory called ftpuser, new ones going appear there , execute 1 command produces reports. when command finishes files need moved directory.

below think have found how command starts. question know how find new entries on directory , execute command can report?

find /directory -type f -name "*.ear" -or -type f -name "*.war"  

it seems you'd want script run indefinitely. loop on files find in order perform desired operations:

while : ;   file in $(find /directory -type f -name "*.[ew]ar");     some_command "${file}"           # execute command file     mv "${file}" /target/directory/  # move file directory   done   sleep 60s                          # maybe sleep while before searching again! done 

Comments

Popular posts from this blog

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

html - How to style widget with post count different than without post count -

url rewriting - How to redirect a http POST with urlrewritefilter -