projects-jenz/file_mover/encap_stripper_mover.sh

42 lines
1.1 KiB
Bash
Raw Permalink Normal View History

#!/bin/bash
upload_dir="/home/test/home/stripper_files/upload"
stripper_dir="/home/gameservers/css_ze/cstrike/addons/stripper/maps"
maps_dir="/home/test/home/stripper_files/maps"
# Check if the source directory exists
if [ -d "$upload_dir" ]; then
for file in "$upload_dir"/*; do
if [ -f "$file" ]; then
# Move each file to the destination directory
chown gameservers:gameservers "$file"
chmod 775 "$file"
mv "$file" "$stripper_dir/"
echo "File '$file' moved successfully."
fi
done
fi
if [ -d "$stripper_dir" ]; then
for file in "$stripper_dir"/*; do
if [ -f "$file" ]; then
#copy each file to maps_dir
cp --force "$file" "$maps_dir/"
echo "File '$file' moved successfully."
fi
done
fi
if [ -d "$maps_dir" ]; then
for file in "$maps_dir"/*; do
if [ -f "$file" ]; then
#copy each file to maps_dir
chown stripper_files:stripper_files "$file"
chmod 775 "$file"
echo "File '$file' modified successfully."
fi
done
fi