Prerequisites
- macOS 14.5 or later
- Terminal access
- Homebrew package manager
Creating the Script
Create a new file named 'ftp' in your project directory
#!/bin/bash
# Configuration
HOST="deutsch.o2switch.net"
USER="claude@elastik.eu"
PASS="*****"
LOCAL_DIR="/users/man/htdocs/___tests/_claude"
REMOTE_DIR="/"
# Check if lftp is installed
if ! command -v lftp &> /dev/null; then
osascript -e 'display dialog "lftp is not installed..."'
exit 1
fi
# Create a temporary file for the lftp script
SCRIPT_FILE=$(mktemp)
# Write the LFTP commands to the temporary file
cat << EOF > "$SCRIPT_FILE"
set ssl:verify-certificate no
open -u "$USER","$PASS" "$HOST"
lcd "$LOCAL_DIR"
mirror --reverse --only-newer --verbose \
--exclude-glob .DS_Store \
--exclude-glob .git/ \
--exclude-glob node_modules/ \
--exclude-glob ftp \
"$LOCAL_DIR" "$REMOTE_DIR"
bye
EOF
# Run the LFTP script
lftp -f "$SCRIPT_FILE"
# Clean up the temporary file
rm "$SCRIPT_FILE"
# Show completion dialog
osascript -e 'display dialog "FTP upload completed!"'
# Keep the terminal window open
read -p "Press Enter to close..."
Installation Steps
-
1
Install lftp
brew install lftp -
2
Make the script executable
chmod +x /users/man/htdocs/___tests/_claude/ftp
Using the Script
The script will:
- Connect to your FTP server automatically
- Upload only modified files
- Exclude unnecessary files (.DS_Store, .git, node_modules, the ftp script itself)
- Show a completion dialog when finished
- Keep the terminal window open until you press Enter
Simply double-click the script file to run it!
Troubleshooting
lftp not installed
If you see an error about lftp not being installed, run the installation command in the Terminal:
brew install lftp