mardi 24 février 2015

Run command automatically when files are copied into a directory


I have two folders called: A and B, in different paths on the same computer. When I add any new file(s) into folder A, I want to copy it to folder B automatically.


My folders:



/auto/std1/nat1/A
/auto/std2/nat2/B


What I currently do to copy the files:



cp -r A B


But I want this process to run automatically in the background for every new file and folder in A into B.


Added question/problem


While copying files I would like specific actions to be performed on certain files types, example: when I have a zip file in folder A, I would like it to unzip this file in folder B automatically.


This is on a CentOS 7` system.



Aucun commentaire:

Enregistrer un commentaire