I have created the following script that move old days files as defined from source directory to destination directory. It is working perfectly.
#!/bin/bash
echo "Enter Your Source Directory"
read soure
echo "Enter Your Destination Directory"
read destination
echo "Enter Days"
read days
find "$soure" -type f -mtime "-$days" -exec mv {} "$destination" \;
echo "Files which were $days Days old moved from $soure to $destination"
This script moves files great, It also move files of source subdirectory, but it doesn't create subdirectory into destination directory. I want to implement this additional feature in it.
with example
/home/ketan : source directory
/home/ketan/hex : source subdirectory
/home/maxi : destination directory
When I run this script , it also move hex's files in maxi directory, but I need that same hex should be created into maxi directory and move its files in same hex there.
--remove-source-files
was helpful, which effectively causes files to be moved instead of copied. This is an awesome use of rsync. – Tom Aug 30 '17 at 05:27rsync --remove-source-files A/ B/
and B is a symlink to A, you'll delete everything in A. It's happened to me every 12 months or so. – Sridhar Sarnobat Aug 31 '22 at 21:50--no-links
option as well. – ryanjdillon Sep 01 '22 at 07:25