mirror of
https://github.com/fccview/cronmaster.git
synced 2026-01-03 11:29:06 -05:00
20 lines
533 B
Bash
20 lines
533 B
Bash
# @id: move-files
|
|
# @title: Move files safely
|
|
# @description: Move files with backup and error handling
|
|
# @category: File Operations
|
|
# @tags: move,mv,backup,safe
|
|
|
|
# Move files with backup
|
|
# Change SOURCE and DEST to your paths
|
|
SOURCE="/path/to/source"
|
|
DEST="/path/to/destination"
|
|
|
|
# Create backup before moving
|
|
if [ -f "$SOURCE" ]; then
|
|
cp "$SOURCE" "${SOURCE}.backup.$(date +%Y%m%d_%H%M%S)"
|
|
mv "$SOURCE" "$DEST"
|
|
echo "File moved successfully with backup created"
|
|
else
|
|
echo "Source file does not exist"
|
|
exit 1
|
|
fi |