Skip to content

Instantly share code, notes, and snippets.

@SebastiaanKloos
Created January 7, 2025 14:56
Show Gist options
  • Save SebastiaanKloos/fee472234ee24f1322ac23b6cd163dd5 to your computer and use it in GitHub Desktop.
Save SebastiaanKloos/fee472234ee24f1322ac23b6cd163dd5 to your computer and use it in GitHub Desktop.
Move storage for ZDD
#!/bin/bash
read -p "Enter domain name (e.g. example.com): " domain_name
HOME_DIR=$HOME
# Check if source exists
if [ ! -d "$HOME_DIR/$domain_name/storage" ]; then
echo "Error: Source storage directory not found"
exit 1
fi
# Ensure target directory exists
mkdir -p "$HOME_DIR/$domain_name-deploy"
# Move storage directory
if ! mv "$HOME_DIR/$domain_name/storage" "$HOME_DIR/$domain_name-deploy/"; then
echo "Error: Failed to move storage directory"
exit 1
fi
# Create symlink
if ! ln -s "$HOME_DIR/$domain_name-deploy/storage" "$HOME_DIR/$domain_name/storage"; then
echo "Error: Failed to create symlink"
exit 1
fi
echo "Storage directory moved and symlinked successfully for $domain_name"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment