I have a test folder with the following structure:driveA  - bar - foo    - fileBarFooA    - fileBarFooB  - fileA  - fileB  - fileC  - folder.A    - fileAA    - fileAB  - folderB    - fileBA    - fileBBWithin a bash shell, I want to rsync driveA's contents into driveB EXCEPT for folder folder.A, to get a resulting copy that looks like:driveB  - bar - foo    - fileBarFooA    - fileBarFooB  - fileA  - fileB  - fileC  - folderB    - fileBA    - fileBBAt first glance, one approach to do this is by providing a filtered ls on the driveA as an argument into rsync:rsync -aR -- `ls -F | grep [^folder.A/]` ../driveBThis results in errors and doesn't complete:The problem is folder bar - foo doesn't get copied. Looking at the error, we see that one problem is that we're feeding ls -F which outputs non-escaped output of filenames and folders::driveA$ ls -Fbar - foo/  fileA       fileB       fileCfolder.A/folderB/I haven't found a option in ls to make it output with escape chars, so instead the next thing to try is post-processing with sed - one way is to add escape chars::driveA vgani$ ls -F | sed 's/\ /\\\ /g' | grep [^folder.A/]bar\ -\ foo/fileAfileBfileCfolderB/Rsyncing with this gives::driveA $ rsync -aR `ls -F | sed 's/\ /\\\ /g' | grep [^folder.A/]` ../driveBrsync: -\: unknown optionrsync error: syntax or usage error (code 1) at /BuildRoot/Library/Caches/com.apple.xbs/Sources/rsync/rsync-51/rsync/main.c(1337) [client=2.6.9]Oh no, an error (and a 1337 one at that!) This is just due to rsync taking in the -\ part of the folder as a command-line argument, so we can fix that by adding in --:driveA $ rsync -aR -- `ls -F | sed 's/\ /\\\ /g' | grep [^folder.A/]` ../driveBSo it looks like the same result as not even bothering with adding escape chars.Another post-processing idea would be to try adding quotation marks instead::driveA $ ls -F | sed 's/^//g' | sed 's/[^/]$//g' | sed 's/\//\//g'bar - foo/filefilefilefolder.A/folderB/But this leads to rsync treating the quotations as literal charaters and copies nothing::driveA $ rsync -aR -- `ls -F | sed 's/^//g' | sed 's/[^/]$//g' | sed 's/\//\//g' | grep [^\folder.A\/]` ../driveBrsync: link_stat /driveA/bar failed: No such file or directory (2)rsync: link_stat /driveA/- failed: No such file or directory (2)rsync: link_stat /driveA/foo/ failed: No such file or directory (2)rsync: link_stat /driveA/file failed: No such file or directory (2)rsync: link_stat /driveA/file failed: No such file or directory (2)rsync: link_stat /driveA/file failed: No such file or directory (2)rsync: link_stat /driveA/folderB/ failed: No such file or directory (2)rsync error: some files could not be transferred (code 23) at /BuildRoot/Library/Caches/com.apple.xbs/Sources/rsync/rsync-51/rsync/main.c(996) [sender=2.6.9]So far I'm stumped, is there a way to feed rsync contents of ls without choking on hyphen characters?  
Rsync directory filtering out files and retaining edge cases (e.g. names w/ hyphen (-) chars)
bash;sed;rsync;ls
Rsync has an exclude option. You should be able to achieve this with:cd /path/to/driveArsync -avWxP --exclude=folder.A . /path/to/driveB/