aboutsummaryrefslogtreecommitdiff
path: root/articles/2025/Upload-modified-blog-files-with-scp.html
diff options
context:
space:
mode:
authorPhilip Wittamore <philip@wittamore.com>2026-07-12 11:08:50 +0200
committerPhilip Wittamore <philip@wittamore.com>2026-07-12 11:08:50 +0200
commit420ceb49b53a8fa9d8ba8443e42e50cd7bd7cea9 (patch)
tree3009f0564d75e3f7d1ca38507e7ebb92deaded07 /articles/2025/Upload-modified-blog-files-with-scp.html
update
Diffstat (limited to 'articles/2025/Upload-modified-blog-files-with-scp.html')
-rwxr-xr-xarticles/2025/Upload-modified-blog-files-with-scp.html65
1 files changed, 65 insertions, 0 deletions
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 @@
+<!doctype html>
+<html lang="EN">
+ <head>
+ <meta charset="utf-8">
+ <meta name="viewport" content="width=device-width, initial-scale=1">
+ <link rel="stylesheet" href="/style.css">
+ <title>Upload modified blog files with scp</title>
+ </head>
+ <body>
+ <header>
+ <h1>Bloggings</h1>
+ <a href="/index.php">Back</a>
+
+ </header>
+
+<main>
+<article>
+<h2>Upload modified blog files with scp</h2>
+<h3>2025-03-29</h3>
+<h4>A simple bash script to update this blog using scp</h4>
+<h3>Note</h3>
+<p>I have my web server aliased in ~/.ssh/config as "web" <br>so the remote folder is web:/folder</p>
+<code>#!/bin/sh
+
+# blogsend : scp blog files to web server
+# usage : <b>blogsend</b> <i>hours</i> (if not set default is 1 hour)
+# example : <b>blogsend 72</b> sends files modified over the past 3 days
+
+# folders
+rf= <i>#add your remote ssh folder here</i>
+mf= <i>#add your local folder here</i>
+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
+</code>
+</article>
+</main>
+<footer>
+<p>&nbsp;</p><p>ยง</p></footer>
+</body></html>