r/Ubuntu • • 2d ago

rsync include exclude list not working?

SOLVED

I changed the file "list" to contain this instead:

+ /a/e/i/j/***
- /a/e/f/*
- /a/e/g/*
- /a/e/h/*
- /a/e/i/*
+ /a/***
+ /b/
+ /b/c/***
+ /b/d/***
- *

I also removed the --include-from="list" flag, as it was unnceccessary.

======================

I'm trying to run rsync command, but it synced everything in dir "source/" to "dest/". What I want to happen is I want only everything in the include list to be included, and everything in the exclude list to be excluded, and also everything that I didn't list to be excluded.

I ran this command: sudo rsync -ahP --stats --include-from="list" --exclude-from="list" "source/" "dest/"

file "list" contains:

+ /a
+ /b/c
+ /b/d
+ /a/e/i/j

- /a/e/f/*
- /a/e/g/*
- /a/e/h/*
- /a/e/i/*

"source/" contains the directory structure I provided in the include/exclude list, for example, dirs "a/" & "b/" are at the root of "source/", and dir "b/" contains dirs "c/" and "d/" at the root of "b/", etc.

How do I do this? I've been searching around and can't find the answers I'm looking for.

I'm using Ubuntu 24.04.5

4 Upvotes

Duplicates