Skip to content

Instantly share code, notes, and snippets.

@madprops
Created December 10, 2024 13:11
Show Gist options
  • Save madprops/38f7c865f5dcc27a03f9bbd8a61a4c84 to your computer and use it in GitHub Desktop.
Save madprops/38f7c865f5dcc27a03f9bbd8a61a4c84 to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
# Check the number of selected files
file_count=$#
if [ $file_count -gt 5 ]; then
echo "More than 5 files selected. Exiting."
exit 1
fi
# Define the remote server variables
remote_server="[email protected]"
remote_directory="/var/www/ftp"
# Loop through the selected files
for file_path in "$@"
do
# Upload the file to the remote server using scp
scp "$file_path" "$remote_server:$remote_directory"
# Get the URL of the uploaded file
file_name=$(basename "$file_path")
url="https://ftp.site.com/$file_name"
# Copy the URL to the clipboard using xclip
echo -n $url | xclip -selection clipboard
awesome-client 'Utils.msg("FTP: Upload Complete")'
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment