[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

query regarding daemon process



Hello all,

I have query regarding daemon process :

I want to creat a daemon process which will copy/remove file/s
into/from DESTINATION directory depending on the change in the
SOURCE directory.i.e. if a file/directory is created in source
directory then that process should copy it into DESTINATION and
if a file/directory is removed then that should be reflected in
DESTINATION.

how to do this ??

one solution I thought about is writing script as follows ,
check the access time for the SOURCE
IF modifies then check if files are added by
  ls | wc -w and if this is greater than previous value,
it means files are added.
copy the entire SOURCE again.

Here ls | wc -w will find if files are added or removed but
how to find which files are removed so that they can be
deleted from DESTINATION. ??

Thank you,
Chaitanya