I have a huge set of backup files, each containing a directory of Videos. Each video directory is slightly different. I would like to merge these into a single directory to conserve, as I don't really care about which backup each Video came from.
To do this, I figure that rsync would be the best tool but I'm having difficulty coming up with a nice clean script to rsync each backup's Video directory with an outside destination.
In other words, I want a script that will automate the following process
rsync -a ./Backups/Backup-x/Videos/ ./CollectedVideos/
rsync -a ./Backups/Backup-y/Videos/ ./CollectedVideos/
rsync -a ./Backups/Backup-z/Videos/ ./CollectedVideos/
rsync -a ./Backups/Backup-t/Videos/ ./CollectedVideos/
Where all files in the Backups/
directory are "fair game."
Any suggestions would be appreciated.
If at least one of the folders in
./Backups
contains aVideo
directory,might be close to what you are looking for.
The
/*
after$dir
is important to copy the files without including their directory.Did using wildcards not work:?
rsync -a backup//Videos/ /
The other way is to use find and xargs:find backups/Backup-*/ -type f -name ""| xargs -I {} -n 1 rsync {} /
Of course, find is a very slow running command