1
我的目錄和文件看起來像這樣複雜的rsync過濾(包括和不包括)
/1.txt
/2.txt
/3.txt
/20170407_000000
/config
file1.txt
/logs
file1.txt
/nav
file1.txt
/schedule
file1.txt
file2.txt
file3.txt
/soh
file1.txt
/tracks
file1.txt
/20170407_120000
/config
file1.txt
/logs
file1.txt
/nav
file1.txt
/schedule
file1.txt
file2.txt
file3.txt
/soh
file1.txt
/tracks
file1.txt
/20170408_000000
/config
file1.txt
/logs
file1.txt
/nav
file1.txt
/schedule
file1.txt
file2.txt
file3.txt
/soh
file1.txt
/tracks
file1.txt
/20170408_120000
/config
file1.txt
/logs
file1.txt
/nav
file1.txt
/schedule
file1.txt
file2.txt
file3.txt
/soh
file1.txt
/tracks
file1.txt
/20170409_000000
/config
file1.txt
/logs
file1.txt
/nav
file1.txt
/schedule
file1.txt
file2.txt
file3.txt
/soh
file1.txt
/tracks
file1.txt
/20170409_120000
/config
file1.txt
/logs
file1.txt
/nav
file1.txt
/schedule
file1.txt
file2.txt
file3.txt
/soh
file1.txt
/tracks
file1.txt
/20170410_000000
/config
file1.txt
/logs
file1.txt
/nav
file1.txt
/schedule
file1.txt
file2.txt
file3.txt
/soh
file1.txt
/tracks
file1.txt
/20170410_120000
/config
file1.txt
/logs
file1.txt
/nav
file1.txt
/schedule
file1.txt
file2.txt
file3.txt
/soh
file1.txt
/tracks
file1.txt
/20170411_000000
/config
file1.txt
/logs
file1.txt
/nav
file1.txt
/schedule
file1.txt
file2.txt
file3.txt
/soh
file1.txt
/tracks
file1.txt
/20170411_120000
/config
file1.txt
/logs
file1.txt
/nav
file1.txt
/schedule
file1.txt
file2.txt
file3.txt
/soh
file1.txt
/tracks
file1.txt
/20170412_000000
/config
file1.txt
/logs
file1.txt
/nav
file1.txt
/schedule
file1.txt
file2.txt
file3.txt
/soh
file1.txt
/tracks
file1.txt
/20170412_120000
/config
file1.txt
/logs
file1.txt
/nav
file1.txt
/schedule
file1.txt
file2.txt
file3.txt
/soh
file1.txt
/tracks
file1.txt
我只想要複製的20170409 _ * /日程,20170410 _ * /日程,20170411 _ * /日程文件夾和內容。
這主要作品:
rsync -avhr --progress --include="/20170409_*/schedule/" --include="/20170410_*/schedule/" --include="/20170411_*/schedule/" --exclude="/*/*" /source/dateTimeDirectories/ /destination/dateTimeDirectories/
然而,這也複製了以下內容:
1.txt
2.txt
3.txt
20170407_000000/
20170407_120000/
20170408_000000/
20170408_120000/
...
20170412_000000/
20170412_120000/
我如何省略了文件,我還沒有包括dateTimeFolders,只得到dateTimeFolder的日程文件夾我已包括在內?
你先生是凡人中的神!實際上是 – lr100
。在真實環境中測試我發現了一些更多的問題。我已經更新了上面的解釋。我們將非常感謝您的幫助。 – lr100
@ lr100我已經更新了我的答案,以處理源根目錄中的* .txt文件。 – Dario