Rsync - not copy certain files

I use this

rsync --progress -r -u /media/andy/MAXTOR_SDB1/Ubuntu_Mate_18.04/* /home/andy/Ubuntu_18.04_Programs/

Is there a way to have it not copy files such as these?

2019-02-25_11:04

I found this but can not figure out what it's doing.

3. Exclude a specific file

 To exclude a specific file, use the relative path of the file in the exclude option as shown below.
 $ rm -rf destination  $ rsync -avz --exclude 'dir1/dir2/file3.txt' source/ destination/

Ubuntu Mate 18.04

The part which does the exclusion is --exclude 'dir1/dir2/file3.txt' so you could try --exclude 'path/to/2019-02-25_11:04'

1 Like

Does it work with wildcards?

Probably. Why don't you set up two test directories and simply try it? It would be a matter of minutes to find out, no?

I hope this helps.

bakunin

2 Likes

See also in the manpage of rsync, especially under Exclude/Include Patterns: Linux Manpages Online - man.cx manual pages

You can specify the -v option(increase verbosity) multiple-times so you see exactly what's going on when testing your commands.

1 Like
--include="[0-2]*"

--- Post updated at 13:20 ---

There is only a pitfall.
/media/andy/MAXTOR_SDB1/Ubuntu_Mate_18.04/*
if there is an asterisk in the directory name, then the shell makes substitutions itself and only then sends to the "rsync" command
In your case, the asterisk is not required
but a trailing slash is necessary!
/media/andy/MAXTOR_SDB1/Ubuntu_Mate_18.04/

1 Like