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
Post a Comment