How to Rsync Consecutive Files in Linux
Rsync is a useful and easy to use command line backup tool in Linux. It has a large number of options designed to give users maximum control over the backup process and is an excellent tool for use with backup shell scripts or scheduled cron jobs. Backing up consecutive files is easy, thanks to the Linux shell's support for wildcards and bracket expressions that can be passed directly to rsync.
Instructions
-
-
1
Open a terminal window so you can work from the command line.
-
2
Use wildcards or patterns to build your list of consecutive files. For instance, if you want to backup a list of jpg files that begin with "file_," you could use "file_*.jpg." Linux would replace the "*" with anything, just as long as everything else matches. If your files are numerically consecutive, you could use something like "file_[0-9].jpg" to get everything from "file_0.jpg" to "file_9.jpg." Changing that to "file_[0-9]*.jpg" would include things like "file_10.jpg" and "file_0506a.jpg."
-
3
Type "rsync -ahv <consecutive file range> <destination directory>" and press enter. The "-a" option instructs rsync to use the "archive" options, which recurses directories, and preserves things like file datetimes, owner amd permissions. The "-h" option makes things a bit more human-readable, and "-v" makes everything verbose, so you can see what's going on. If you want to see what would happen without actually starting the backup, use the "--dry-run" option.
-
1