To exclude a specific file type, in this case. iso files that you do not need to back up. Use an asterisk * followed by the extension of the file type you want to exclude.įor example, you may want to back up a directory that contains many. The rsync tool allows you to exclude certain file types when synchronizing data. You can use an asterisk before and after a pattern to additionally refine the -exclude criterion. Run this command to exclude all directories that end with number 3: rsync -av -exclude '*3' sourcedir/ destinationdir/ You can also use the wildcard in a similar matter to exclude all directories that end with a specific pattern. To exclude files that start with test, run this command: rsync -av -exclude 'test*' sourcedir/ destinationdir/Įvery file and directory that matches this pattern will be excluded from the transfer. Use an asterisk * (wildcard) when defining a file or directory name to exclude everything that matches the pattern. Exclude Files or Directories Based on a Pattern How to install the NVIDIA drivers on Ubuntu 18.This command copied the contents of sourcedir into destinationdir and excluded dir1, as seen in the output.How to Install Adobe Acrobat Reader on Ubuntu 20.04 Focal Fossa Linux.Set Kali root password and enable root login.How to change from default to alternative Python version on Debian Linux.Netplan static IP on Ubuntu configuration.How to enable/disable firewall on Ubuntu 18.04 Bionic Beaver Linux.How to install Tweak Tool on Ubuntu 20.04 LTS Focal Fossa Linux.Linux IP forwarding – How to Disable/Enable.How to use bash array in a shell script.AMD Radeon Ubuntu 20.04 Driver Installation.How to install missing ifconfig command on Debian Linux.Ubuntu 20.04 Remote Desktop Access from Windows 10.How to find my IP address on Ubuntu 20.04 Focal Fossa Linux.How to install the NVIDIA drivers on Ubuntu 20.04 Focal Fossa Linux.List one directory per line as you’re compiling the list of directories that you want to exclude. The file should be plaintext, so a simple. The -exclude-from rsync option allows us to specify a file that contains a list of directories to be excluded. But that’s where rsyn’c other option -exclude-from comes into play. What if we want to exclude 15 directories? That command will be a monstrosity. The command above will do its job as expected, but as you can see, the command grows gradually more unwieldy as we append more excluded directories to it. $ rsync -av -exclude some/subdir/linuxconfig -exclude some/other/dir -exclude exampledir /path/to/src/ /path/to/dest/ Let’s try excluding three directories from our rsync transfer with this command: Now, how about multiple directories? We can use as many -exclude options as we want. $ rsync -av -exclude some/subdir/linuxconfig /path/to/src/ /path/to/dest/ In that case, our rsync command would look like this: Therefore, rsync assumes that directory linuxconfig is inside of /path/to/src.īut what if the linuxconfig directory is actually a bit deeper in our source directory? Let’s say that the absolute path to the directory we wish to exclude is actually /path/to/src/some/subdir/linuxconfig. Note, however, that the path to linuxconfig is relative to that of our source path, which in this case is /path/to/src. In the command above, we are synchronizing the contents of /path/to/src with that of /path/to/dest and omitting the linuxconfig directory. $ rsync -av -exclude linuxconfig /path/to/src/ /path/to/dest/ Here’s how it would be used to exclude the directory linuxconfig in the example command below. The first option we’ll cover is using the -exclude option in the rsync command.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |