[英]Exclude sub directories recursively from folder
我在這個路徑app/static/uploads/
中有一些子文件夾
我期待--exclude="uploads"
將完成忽略子文件夾中所有內容的工作。 但是,我仍然在同步app/static/uploads/companies/headers/photo.jpg
類的內容。 知道如何忽略uploads
文件夾中所有內容的同步嗎?
switches: -vzr --exclude="uploads" --exclude=".git" --exclude=".github" --exclude=".gitattributes" --exclude=".gitignore"
您的排除模式不符合您的意圖的正則表達式。
您需要執行以下操作:
EXCL_DIRS="--exclude='*/uploads/*'"
EXCL_SUFS="--exclude='.git' --exclude='.github' --exclude='.gitattributes' --exclude='.gitignore'"
rsync --recursive --compress --verbose ${EXCL_DIRS} ${EXCL_SUFS}
如果所有的 EXCL_SUFS 規范都是針對您的 EXCL_DIRS 下的文件,那么您不需要定義 EXCL_SUFS。
建議使用--dry-run選項,直到您確定您的命令結構將按預期執行(通過檢查 rsync 報告的文件列表進行視覺驗證)。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.