linux - how to find and execute command for each file in a directory? -


i have directory containing multiple files. these files coming via network location; source sending these file via scp command. have batch command run each of these incoming files; command runs around 5-6 hours.

i trying run below command in linux box

find  documents/wget/ -maxdepth 1 -type f -exec btaudip '{}' \; 

my goal start batch program files in directory simultaneously. but, above command run 1 file @ time. so, changed command below. failed.

find  documents/wget/ -maxdepth 1 -type f -exec btaudip '{}' & \; 

how should change command this?

the fact find gathers arguments after -exec option first semicolon , runs (exec) resulting command, without passing them shell. modifications, final command generated find like:

btaudip fname '&' 

therefore @ each run btaudip passed 2 parameters: current file name (as found find) , ampersand.

to achieve want, need invoke shell process '&' correctly, example using following command:

find  documents/wget/ -maxdepth 1 -type f -exec bash -c "btaudip '{}' &" \; 

Comments

Popular posts from this blog

Payment information shows nothing in one page checkout page magento -

tcpdump - How to check if server received packet (acknowledged) -