On Sun, May 12, 2024 at 08:08:17PM +1000, Alexis wrote: > Andreas Kähäri <andreas.kah...@abc.se> writes: > > > Well, that's one way to control this trainwreck of a script; just say > > that any name containing "inappropriate" characters aren't allowed! > > > > May I ask why you don't simply use rsync(1) (or even openrsync(1) from > > the OpenBSD base system)? > > i'm not sure why you're addressing this to me, as i'm not the OP.
It's addressed to the thread in general. > > That said, yes, minimising the extent to which certain non-'word' characters > (i.e. roughly the POSIX 'alnum' class as described in re_format(7)) _can_ > make it easier to programatically do certain tasks which are restricted by > the long and messy history of C and Unix development. Given that i've been > using computers for a few decades, i still instinctively don't use spaces in > filenames, even though they're very much allowed. But of course, that's not > what most of the world does, and this is an example of trying to work out > what the best tradeoffs might be when dealing with the messiness of the real > world. > > > Alexis. With rsync(1): rsync -n -aim --delete-excluded \ --include-from=list \ --include='*/' \ --exclude='*' \ source/ target This would read your inclusion patterns from the file "list" (it is assumed that directories are entered as "dirname/***", which matches the name "directory" and all its content), include any directory, and then finaly exclude anything not already included. The matched names would be synchonised from beneath "source" to "target", and excluded names would be deleted from the target. With "-m", we don't keep directories at the target that ends up being empty. -- Andreas (Kusalananda) Kähäri SciLifeLab, NBIS, ICM Uppsala University, Sweden .