Help with RegEx

Here’s what I want to accomplish: Backup the C:\Users directory and include each user’s subdir BUT ONLY selected subdirectories below that (Desktop, Documents, Music, etc).

It does not appear that the Wildcard filter format will support that and I’m struggling with finding the right Regular Expression language.

Any suggestions?

If you know the list of users this should work:

+*\Desktop*
+*\Documents*
+*\Music*
...
+user1\
+user2\
+user3\
...
-*

Thanks. This appears to be working.

But I think the back slashes need to be changed to forward slashes, yes?

But I think the back slashes need to be changed to forward slashes, yes?

Yes, and considering that even Gilbert himself is making that mistake, I feel encouraged to suggest that duplicacy should understand both back- and forward slashes. Apart from that its insistence on forward slashes can give you headaches when you overlook a backslash or when you’re not aware of the limitation, it also prevents Windows users from using the “copy as path” option in the Ctrl+right-click conrext menu (or if you do, you’ll have to manually change the whole path).

1 Like

Right, sometimes I got confused when I constantly switch between Windows and macOS.

I think we can do a replace to change backward slashes to forward slashes. This is an easy change. But it should apply to wildcard patterns only.

But it should apply to wildcard patterns only.

Potentially even more confusing, but I see the problem with running a replace on regular expressions since there is no (?) way to tell which backslash is a file-path-backslash and which isn’t. Plus, we can expect that regular expressions are by their very nature constructed and inspected much more carefully that the wildcard patterns. So, yes, I guess this is a good solution.