rsync files from subfolders on source to root of a folder on destination

Paul Slootman paul+rsync at wurtel.net
Mon Apr 23 03:27:12 MDT 2012


On Mon 23 Apr 2012, James Robertson wrote:
> 
> So on the destination the structure is:
> 
> destination> tree /Destination/
> /Destination/
> ├── R
> │   ├── Radiohead
> │   │   └── OK Computer
> │   │       ├── 01 - Radiohead - Airbag.flac
> │   └── Red Hot Chilli Peppers
> │       └── Greatest Hits
> │           ├── 01 - Red Hot Chili Peppers - Under the Bridge.flac
> 
> I want to prune all directories so only the files are placed into the
> root of /Destination/ e.g.
> 
> destination> tree /Destination/
> /Destination/
> ├── 01 - Radiohead - Airbag.flac
> ├── 02 - Radiohead - Paranoid Android.flac
> ├── 01 - Red Hot Chili Peppers - Under the Bridge.flac
> ├── 02 - Red Hot Chili Peppers - Give It Away.flac

How about:
    cd Music
    rsync -ai --relative */*/*/./ /Destination/

Assuming the argument list doesn't get too large, I think it should
work as desired.


Paul


More information about the rsync mailing list