1

I want to run service to listen on directory modifying and for every add or file modify run a function but I get more one event from adding directory

inotifywait -rm -e create,modify "$dir" |
while read folder eventlist eventfile
do
   echo $folder $eventlist  $eventfile
done

when I add one directory 'ssss' output:

/root/business_layer/ CREATE,ISDIR ssss
/root/business_layer/ssss/ CREATE 1
/root/business_layer/ssss/ MODIFY 1
/root/business_layer/ssss/ CREATE www
/root/business_layer/ssss/ MODIFY www
/root/business_layer/ssss/ CREATE 112
/root/business_layer/ssss/ MODIFY 112
/root/business_layer/ssss/ CREATE asd

is there any way to get only /root/business_layer/ CREATE,ISDIR ssss

1 Answer 1

1

Not quite sure what you mean.

The events you want to discard concern the contents of the newly-created directory ssss. They appear in your log only because you have specified the recursive option, -r, so that they can be dropped just by issuing the same command without that option. This way, you will be watching only the top directory, /root/business_layer, not its subdirectories.

Is this what you want?

2
  • I have subdirectories dir="/root"
    – Steve
    Feb 4, 2014 at 21:26
  • I want to listen and for every event upload it to Team Foundation Server
    – Steve
    Feb 5, 2014 at 5:40

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .