[英]Linux find and rsync: how to find and rsync keeping the directories?
How can I find files from a directory and save those files in the subdirectories it was found in?如何从目录中查找文件并将这些文件保存在找到它的子目录中?
FileDirectory:文件目录:
TestFolder测试文件夹
Currently using this script:当前使用此脚本:
find TestFolder -type f -newermt '2021-04-01 10:15:00' ! -newermt '2021-04-30 10:15:00' -exec rsync -avz {} /home/user/save/FilesSaved/ \;
This will search in my subdirectories and pull out files and save it individually into FileSaved directory.这将在我的子目录中搜索并提取文件并将其单独保存到 FileSaved 目录中。
Inside FileSaved Directory:在 FileSaved 目录中:
I want it to store into folders where it was found ex:我希望它存储到找到它的文件夹中:
FileSaved Directory:文件保存目录:
- Folder1
- FileFromFolder1.txt
- Folder2
- FileFromFolder2.txt
- Folder3
- FileFromFolder3.txt
Add a -R
to your rsync
flags (not having tested this).将
-R
添加到您的rsync
标志(未对此进行测试)。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.