
Есть ли простой способ синхронизировать папку со списком каталогов через HTTP?
Редактировать:
Спасибо за совет с wget! Я создал скрипт оболочки и добавил его как cron-задание:
remote_dirs=( "http://example.com/" "…") # Add your remote HTTP directories here
local_dirs=( "~/examplecom" "…")
for (( i = 0 ; i < ${#local_dirs[@]} ; i++ )) do
cd "${local_dirs[$i]}"
wget -r -l1 --no-parent -A "*.pdf" -nd -nc ${remote_dirs[$i]}
done
# Explanation:
# -r to download recursively
# -l1 to include only one directory depth
# --no-parent to exclude parent directories
# -A "*.pdf" to accept only .pdf files
# -nd to prevent wget to create directories for everything
# -N to make wget to download only new files
Редактировать 2:
Как упоминалось ниже, можно также использовать --mirror
( -m
), что является сокращением для -r -N
.
решение1
wget
отличный инструмент.
Использоватьwget -m http://somesite.com/directory
-m
--mirror
Turn on options suitable for mirroring. This option turns on
recursion and time-stamping, sets infinite recursion depth and
keeps FTP directory listings. It is currently equivalent to
-r -N -l inf --no-remove-listing.
решение2
Как rsync, но используйтеzsyncдля получения с httpd-сервера.