1

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.

2 Answers 2

2

If at least one of the folders in ./Backups contains a Video directory,

for dir in ./Backups/*/Videos
do
    if [[ -d $dir ]]
    then
        rsync -a $dir/* ./CollectedVideos/
    fi
done

might be close to what you are looking for.

The /* after $dir is important to copy the files without including their directory.

0
0

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

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .