From 420ceb49b53a8fa9d8ba8443e42e50cd7bd7cea9 Mon Sep 17 00:00:00 2001 From: Philip Wittamore Date: Sun, 12 Jul 2026 11:08:50 +0200 Subject: update --- .../2025/Upload-modified-blog-files-with-scp.html | 65 ++++++++++++++++++++++ 1 file changed, 65 insertions(+) create mode 100755 articles/2025/Upload-modified-blog-files-with-scp.html (limited to 'articles/2025/Upload-modified-blog-files-with-scp.html') diff --git a/articles/2025/Upload-modified-blog-files-with-scp.html b/articles/2025/Upload-modified-blog-files-with-scp.html new file mode 100755 index 0000000..9b28eed --- /dev/null +++ b/articles/2025/Upload-modified-blog-files-with-scp.html @@ -0,0 +1,65 @@ + + + + + + + Upload modified blog files with scp + + +
+

Bloggings

+ Back + +
+ +
+
+

Upload modified blog files with scp

+

2025-03-29

+

A simple bash script to update this blog using scp

+

Note

+

I have my web server aliased in ~/.ssh/config as "web"
so the remote folder is web:/folder

+#!/bin/sh + +# blogsend : scp blog files to web server +# usage : blogsend hours (if not set default is 1 hour) +# example : blogsend 72 sends files modified over the past 3 days + +# folders +rf= #add your remote ssh folder here +mf= #add your local folder here +cd $mf + +# test if option is sent +if [[ -z "$1" ]]; then + HOURS=1; +else + # test if option is a number + if [[ "$1" =~ ^[0-9]+$ ]]; then + HOURS=$1; + else + HOURS=1; + fi +fi + +MINUTES=$(($HOURS*60)) + +echo "Sending files modified in the past $HOURS hour(s)..." + +files=$(find * -path .tmp -prune -o -mmin -$MINUTES -type f) +for file in $files +do + echo -ne "-> "; + scp -r "$file" "$rf/$file"; +done + +echo "Done." + +exit 0 + +
+
+ + -- cgit v1.3.1