I have several directories and sub-directories containing various file types (video, text, etc.) and I would like to copy only the video files into a single directory.
The contents of the source directories is always changing and I would like to set up something to do this automatically (using cron or something similar) but I can’t seem to figure out how to copy just the newest video files into a single directory.
I’m no expert on bash scripting or cron, but this does look like a way forward. You could create a script with cp commands using wildcards and the relevant file extensions (.avi, .mp4 etc.). Once you had the script working to your satisfaction, it should be possible to set it up to run at particular times (with cron) or with particular events (e.g. at start up).
Maybe this can help you.
It certainly did! Thank you, Akito.
I had to tinker a bit and I discovered the --include-from=FILE and --exclude-from=FILE option which makes it much easier to target only the file types I want.
As expected, the first run through took several minutes but the second run took only a couple of seconds because there were no new files.
And thank you, too, Winston.