init commit

This commit is contained in:
mk
2025-08-02 00:18:14 -03:00
commit 58ff8602db

110
nextcloud-emulator-sync.sh Normal file
View File

@@ -0,0 +1,110 @@
#!/bin/bash
###################
#
# Folders locations
#
###################
EMU_FOLDERS='
"Ares"
"BigPEMu"
"BlastMm"
"bnes"
"Cemu"
"Citra"
"Desmume"
"Dolphin"
"DuckStation"
"Flycast"
"Genesis Plus GX"
"gopher64"
"Mame"
"mednafen"
"MelonDS"
"Mesen"
"Mesen"
"mGBA"
"Opera"
"PCSX2"
"PicoDrive"
"PPSSPP"
"PuNES"
"RetroArch"
"RPCS3"
"Ryujinx"
"SameBoy"
"ShadPS4"
"Simple64"
"Snes9x"
"stela"
"Vita3k"
"xemu"
"Xenia"
"Yuzu"
'
###################
#
# Nextcloud create folder script
#
###################
# Prompt user for inputs
read -p "Enter your Nextcloud server URL (e.g., https://cloud.example.com): " SERVER
read -p "Enter your Nextcloud username: " USERNAME
read -p "Enter your Nextcloud password (or app password): " PASSWORD
# Check if the URL starts with "http://" or "https://"
case "$SERVER" in
http://*|https://*) ;;
*) SERVER="https://$SERVER" ;;
esac
echo "Using Nextcloud server: $SERVER"
sleep 1
# If we create it all inside it's own folder or root
read -p "Enter the folder path where files should be created (default is root '/'): " FOLDER_PATH
# Set root if user skips it
if [ -z "$FOLDER_PATH" ]; then
FOLDER_PATH="/"
fi
echo "Files will be created in: $FOLDER_PATH"
sleep 1
echo "Starting folder creation process with $SERVER..."
# Loop over each folder and create it
echo "Creating root folder"
echo "$USERNAME:$PASSWORD" -X MKCOL "$SERVER/remote.php/dav/files/$USERNAME$FOLDER_PATH"
#curl -u $USERNAME:$PASSWORD -X MKCOL "https://$SERVER/remote.php/dav/files/$USERNAME$MEDNAFEN_CLOUD" || echo "Folder already exists or could not be created."
HTTP_CODE=$(curl -s -o /dev/null -w "%{http_code}" -u "$USERNAME:$PASSWORD" -X MKCOL "$SERVER/remote.php/dav/files/$USERNAME/$FOLDER_PATH")
if [ "$HTTP_CODE" = "201" ]; then
echo "✅ Created: $FULL_PATH"
elif [ "$HTTP_CODE" = "405" ]; then
echo "⚠️ Already exists: $FULL_PATH"
else
echo "❌ Error ($HTTP_CODE): Could not create $FULL_PATH"
fi
for RELATIVE_PATH in $EMU_FOLDERS; do
# Remove quotes (optional if you don't use them in curl)
RELATIVE_PATH=$(echo "$RELATIVE_PATH" | sed 's/^"//' | sed 's/"$//')
FULL_PATH="${FOLDER_PATH%/}/${RELATIVE_PATH%/}"
echo "Creating: $FULL_PATH"
HTTP_CODE=$(curl -s -o /dev/null -w "%{http_code}" -u "$USERNAME:$PASSWORD" -X MKCOL "$SERVER/remote.php/dav/files/$USERNAME/$FULL_PATH")
if [ "$HTTP_CODE" = "201" ]; then
echo "✅ Created: $FULL_PATH"
elif [ "$HTTP_CODE" = "405" ]; then
echo "⚠️ Already exists: $FULL_PATH"
else
echo "❌ Error ($HTTP_CODE): Could not create $FULL_PATH"
fi
done