<div dir="ltr"><div dir="ltr">On Tue, Sep 29, 2020 at 7:38 AM Rob Campbell wrote:<br></div><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">I would like to sync many subdirectories into one directory with no subdirectories. I've tried<div><br clear="all"><div><div dir="ltr"><div dir="ltr"><span style="border-collapse:separate;color:rgb(0,0,0);font-family:"Times New Roman";font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:normal;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;font-size:medium"><span style="font-family:arial;font-size:small"><div>rsync -rv --progress --include '*.jp*g' --include '*.png' --include '*.dng' --include '*.raw' --include '*.nef' --include 'Duo' --include 'DCIM' --include 'WhatsApp' --exclude '*' /my/phone/root/dir/ /my/backup/directory/for/images/</div></span></span></div></div></div></div></div></blockquote><div class="gmail_quote"><br></div>You didn't specify what isn't working as you expect. That command works fine for the 3 listed dir names as long as you either don't have matching files inside /my/phone/root/dir (or as long as it's ok to also copy those files) and as long as there aren't subdirs or files named the same as the 3 top dirs you included. The latter can be fixed by anchoring your dir names and making them only match a dir (e.g. --include '/Duo/').  If you want to have the copy avoid files in the top dir you can either change all the file-based includes to have a "*/" prefix (such as "--include '*/*.png' ...") or you can change the dir includes into args and exclude '*/*' instead of "*".  The last option would look like this (I also tossed in -i):</div><div class="gmail_quote"><br></div><div class="gmail_quote">rsync -riv --progress --include '*.jp*g' --include '*.png' --include '*.dng' --include '*.raw' --include '*.nef'  --exclude '*/*' /my/phone/root/dir/{Duo,DCIM,WhatsApp} /my/backup/directory/for/images/</div><div class="gmail_quote"><br></div><div class="gmail_quote">That assumes you've got bash to do the brace expansion, but you could change that into 3 arg paths if you need to. You may also want to add --del if you want rsync to delete inside the 3 listed dirs.</div><div class="gmail_quote"><br></div><div class="gmail_quote">I'm not sure why you listed an extra command with "NewDir" when it's not mentioned in the first command.  If that is an indication that you really want to copy all dirs under root/dir (not just the 3 named dirs in the first command) then you could use an include of "/*/" to match any dir in the root of the transfer, like this:</div><div class="gmail_quote"><br></div><div class="gmail_quote">rsync -riv --progress --include '*.jp*g' --include '*.png' --include '*.dng' --include '*.raw' --include '*.nef' --include '/*/' --exclude '*' /my/phone/root/dir/ /my/backup/directory/for/images/<br></div><div class="gmail_quote"><br></div><div class="gmail_quote">One last suggestion, I like to make the args shorter by using -f (filter) commands, so an include example is -f '+ *.png' and an exclude example is -f '- /*/' (those are identical to the equivalent include/exclude args, so that's just personal preference).</div><div class="gmail_quote"><br clear="all"><div>..wayne..</div></div></div>