Skip to main content
added 51 characters in body
Source Link
Satō Katsura
  • 13.7k
  • 2
  • 34
  • 52

Surprisingly, this can actually be done with rsync(1) alone, without shell access to the remote server.

Assuming bash(1) and GNU date(1):

#! /usr/bin/env bash src=rsync://example.com/archives/ dst=/path/to/mirrors cutoff=$( date -d '7 days ago' +%s ) rsync -na --no-motd --out-format='%M %f' "$src" "$dst" | \ while IFS=' 'IFS= read -r d fn;line; do d=${line%% *} fn=${line#* } fdate=$( date -d "${d/-/ }" +%s ) || continue if [ $fdate -ge $cutoff ]; then printf '%s\0' "$fn"; fi done | \ rsync -a --files-from=- -0 "$src" "$dst" 

Surprisingly, this can actually be done with rsync(1) alone, without shell access to the remote server.

Assuming bash(1) and GNU date(1):

#! /usr/bin/env bash src=rsync://example.com/archives/ dst=/path/to/mirrors cutoff=$( date -d '7 days ago' +%s ) rsync -na --no-motd --out-format='%M %f' "$src" "$dst" | \ while IFS=' ' read -r d fn; do fdate=$( date -d "${d/-/ }" +%s ) || continue if [ $fdate -ge $cutoff ]; then printf '%s\0' "$fn"; fi done | \ rsync -a --files-from=- -0 "$src" "$dst" 

Surprisingly, this can actually be done with rsync(1) alone, without shell access to the remote server.

Assuming bash(1) and GNU date(1):

#! /usr/bin/env bash src=rsync://example.com/archives/ dst=/path/to/mirrors cutoff=$( date -d '7 days ago' +%s ) rsync -na --no-motd --out-format='%M %f' "$src" "$dst" | \ while IFS= read -r line; do d=${line%% *} fn=${line#* } fdate=$( date -d "${d/-/ }" +%s ) || continue if [ $fdate -ge $cutoff ]; then printf '%s\0' "$fn"; fi done | \ rsync -a --files-from=- -0 "$src" "$dst" 
added 8 characters in body
Source Link
Satō Katsura
  • 13.7k
  • 2
  • 34
  • 52

Surprisingly, this can actually be done with rsync(1) alone, without shell access to the remote server.

Assuming bash(1) and GNU date(1):

#! /usr/bin/env bash src=rsync://example.com/archives/ dst=/path/to/mirrors cutoff=$( date -d '7 days ago' +%s ) rsync -na --no-motd --out-format='%M %f' "$src" "$dst" | \ while IFS=' ' read -r d fn; do fdate=$( date -d "${d/-/ }" +%s ) || continue if [ $fdate -ge $cutoff ]; then printf '%s\0' "$fn"; fi done | \ rsync -a --files-from=- -0 "$src" "$dst" 

Surprisingly, this can actually be done with rsync(1) alone, without shell access to the remote server.

Assuming bash(1) and GNU date(1):

#! /usr/bin/env bash src=rsync://example.com/archives/ dst=/path/to/mirrors cutoff=$( date -d '7 days ago' +%s ) rsync -na --no-motd --out-format='%M %f' "$src" "$dst" | \ while read -r d fn; do fdate=$( date -d "${d/-/ }" +%s ) || continue if [ $fdate -ge $cutoff ]; then printf '%s\0' "$fn"; fi done | \ rsync -a --files-from=- -0 "$src" "$dst" 

Surprisingly, this can actually be done with rsync(1) alone, without shell access to the remote server.

Assuming bash(1) and GNU date(1):

#! /usr/bin/env bash src=rsync://example.com/archives/ dst=/path/to/mirrors cutoff=$( date -d '7 days ago' +%s ) rsync -na --no-motd --out-format='%M %f' "$src" "$dst" | \ while IFS=' ' read -r d fn; do fdate=$( date -d "${d/-/ }" +%s ) || continue if [ $fdate -ge $cutoff ]; then printf '%s\0' "$fn"; fi done | \ rsync -a --files-from=- -0 "$src" "$dst" 
deleted 5 characters in body
Source Link
Satō Katsura
  • 13.7k
  • 2
  • 34
  • 52

Surprisingly, this can actually be done with rsync(1) alone, without shell access to the remote server.

Assuming bash(1) and GNU date(1):

#! /usr/bin/env bash src=rsync://example.com/archives/ dst=/path/to/mirrors cutoff=$( date -d '7 days ago' +%s ) rsync -na --no-motd --out-format='%M %f' "$src" "$dst" | \ while IFS= read -r d fn; do fdate=$( date -d "${d/-/ }" +%s ) || continue if [ $fdate -ge $cutoff ]; then printf '%s\0' "$fn"; fi done | \ rsync -a --files-from=- -0 "$src" "$dst" 

Surprisingly, this can actually be done with rsync(1) alone, without shell access to the remote server.

Assuming bash(1) and GNU date(1):

#! /usr/bin/env bash src=rsync://example.com/archives/ dst=/path/to/mirrors cutoff=$( date -d '7 days ago' +%s ) rsync -na --no-motd --out-format='%M %f' "$src" "$dst" | \ while IFS= read -r d fn; do fdate=$( date -d "${d/-/ }" +%s ) || continue if [ $fdate -ge $cutoff ]; then printf '%s\0' "$fn"; fi done | \ rsync -a --files-from=- -0 "$src" "$dst" 

Surprisingly, this can actually be done with rsync(1) alone, without shell access to the remote server.

Assuming bash(1) and GNU date(1):

#! /usr/bin/env bash src=rsync://example.com/archives/ dst=/path/to/mirrors cutoff=$( date -d '7 days ago' +%s ) rsync -na --no-motd --out-format='%M %f' "$src" "$dst" | \ while read -r d fn; do fdate=$( date -d "${d/-/ }" +%s ) || continue if [ $fdate -ge $cutoff ]; then printf '%s\0' "$fn"; fi done | \ rsync -a --files-from=- -0 "$src" "$dst" 
Source Link
Satō Katsura
  • 13.7k
  • 2
  • 34
  • 52
Loading