Add minio-upload skill and update README.md to match actual project structure

This commit is contained in:
Misaka Company
2026-01-28 09:20:17 +08:00
parent bdd2df7e75
commit 5f9d79fbb0
3 changed files with 148 additions and 12 deletions

View File

@@ -0,0 +1,44 @@
#!/bin/bash
#
# Upload files to MinIO obsidian bucket
# Usage: upload_to_obsidian.sh <file_path> [subpath]
#
# Arguments:
# file_path - Path to the file to upload
# subpath - Optional subpath within obsidian bucket (default: main)
#
# Examples:
# upload_to_obsidian.sh temp/file.md
# upload_to_obsidian.sh temp/file.md notes/2024
# upload_to_obsidian.sh temp/file.md "archive/old projects"
set -e
# Check arguments
if [ $# -lt 1 ]; then
echo "Usage: $0 <file_path> [subpath]" >&2
exit 1
fi
FILE_PATH="$1"
SUBPATH="${2:-main}" # Default to 'main' if not specified
# Validate file exists
if [ ! -f "$FILE_PATH" ]; then
echo "Error: File '$FILE_PATH' does not exist" >&2
exit 1
fi
# Get filename
FILENAME=$(basename "$FILE_PATH")
# Construct target path
TARGET_PATH="minio/obsidian/${SUBPATH}/${FILENAME}"
# Ensure subpath ends without trailing slash for mc
TARGET_PATH=$(echo "$TARGET_PATH" | sed 's://*:/:g')
# Upload file
mc cp "$FILE_PATH" "$TARGET_PATH"
echo "✅ Uploaded: $FILE_PATH -> $TARGET_PATH"