Add minio-upload skill and update README.md to match actual project structure
This commit is contained in:
44
skills/minio-upload/scripts/upload_to_obsidian.sh
Executable file
44
skills/minio-upload/scripts/upload_to_obsidian.sh
Executable 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"
|
||||
Reference in New Issue
Block a user