[LINUX] Rsync multiple files at once

--files-from option

--Enter the file names you want to rsync in a text file separated by line breaks --Specify the text file and send it with a single rsync command -** The files you want to rsync must be stored in the same directory. ** **

Preparation

Enter the file name in /path/to/images.txt (separated by line breaks)

images.txt


file1.png
file2.png
file3.png

Implementation

$images = '/path/to/images.txt'
$src_path = '/path/to/src/';
$tar_path = '/path/to/tar/';
$rsync_host = 'User [email protected] IP address';

$command = "rsync -av --files-from=".$images." ".$src_path." ".$rsync_host.":".$tar_path;
exec ( $command, $output, $ret );
if($ret == 0) {
   return true;
} else {
   return false;
}

Recommended Posts

Rsync multiple files at once
Convert multiple proto files at once with python
[Linux] Grep multiple gzip files in a directory at once
Get out of multiple loops at once
Erase image files at once with one liner
Update multiple tables at once with pandas to_sql
Register multiple self-made styles in Word at once
Beginners try to convert Word files to PDF at once
Generate multiple HTML files at once by pouring JSON data into an HTML template with Python
Decompress multiple compressed files (Python)
Create multiple users with serial numbers at once with Ansible Playbook
Upload multiple files in Flask
Use gitlabApi to add members to multiple groups in gitlab at once
[Laravel] Aliase to create migration file of multiple tables at once
Cropping images at once [python] [Pillow]
[Blender] Split Blender script into multiple files
Load multiple JavaScript files with PyWebView
Replace all at once with sed
Combine multiple dictionaries and add multiple elements at once, safely and non-destructively in Python
Create multiple users with serial numbers at once in Ansible Playbook: Part 2
[High-speed version] Search files or directories and delete them all at once
Create multiple line charts from a data frame at once using Matplotlib