I'm trying to rsync a folder, but only some specific contents matching pattern and exluding the remaining files.
I tried many solutions, followed advices from #2503 and #11111793, but I can't achieve a simple (at least in my mind) copy :/
This is my folders tree :
/
- A
- B.html
css/
- .gitkeep
- source.css
- source.min.css
- source.min.css.map
sub/
- source.css
- source.min.css
- source.min.css.map
- ...
js/
- ... Same as CSS
img/
- image.png
- sub/
- image.png
- ...
The goal is to rsync :
/*.htmlAll HTML files at root (no other file types)/css/**/*.min.cssAll built files into /css and subfolders recursively/css/**/*.min.css.mapAll mapping files into /css and subfolders recursively/js/**/*.min.jsAll built files into /js and subfolders recursively/js/**/*.min.js.mapAll mapping files into /js and subfolders recursively/img/**/*All files into /img and subfolders recursively
I tried so many things, like include /* and exclude *, etc.
An example :
rsync -zarv \
--include="/*.html" \
--include="/js/**/*/min.js" \
--include="/js/**/*.min.js.map" \
--include="/css/**/*.min.css" \
--include="/css/**/*.min.css.map" \
--include="/img/***" \
--exclude="*" \
--delete \
./ $to
The 3 stars helped me for the img/ folder and copy it with everything inside, including subfolders ; it didn't work with /img/* nor with /img/**/* (no files synced, not even the img folder itself).
I don't understand... what I don't understand -.-'
Could someone help me ?
Subsidiary question : the glob pattern /js/**/*.min.* doesn't seem to work, can we use wildcard only at start of paths ?
Thanks !