I've never used entr before, but I intend to write a command in /etc/rc.local to copy the contents of a folder into another folder, every time a change is made inside the original folder.
For this example I have created two folders, one is 'test1' which will have the file in it, the other is 'test2' which will have folders generated named with the current time and these will contain the changes to the contents of test1 at the time. My attempt is as follows, but it doesn't work and gets the error "bash: '/home/Rob/Desktop/test1/2': No such file or directory entr: exec mkdir:: No such file or directory"
$ ls -d ~/Desktop/test1/* | entr $(mkdir ~/Desktop/test2/name_$(date '+%Y_%m_%d_%H_%M') ; $(cp ~/Desktop/test1/* ~/Desktop/test2/name_$(date '+%Y_%m_%d_%H_%M')))
The above will work only when I past into the terminal, not after I leave it running and make changes inside test1.
Note: I'll probably use rsync when I get this working, rather than cp.
Thanks.
entr
is, but I do know that neithercp
normkdir
outputs anything, so putting them in command substitutions ($(...)
) makes little sense. See also Why *not* parse `ls` (and what to do instead)?