I need help with small command
In /home/pi there are two directories media and adverts.
I want all mp4 files from media to be copied in adverts.
If mp4 file is deleted from media dir, it should also get deleted from adverts.
So I tried below rsync command, it copies new files, but could not delete if it is deleted from media folder.
media folder got other files such as txt, json , etc.. which I don't want.
Code: Select all
rsync -av --delete /home/pi/media/*.mp4 /home/pi/adverts
Alternately I can archive same with small sh as below, but it takes a long route.
Code: Select all
#!/bin/sh
cd /home/pi/adverts
rm *
cd /home/pi/media
cp *.mp4 /home/pi/adverts
exit
Please guide me with correct route.