How to find files and then move to a different directory

How to find files older than 1 day and move to different location for backup
#!/bin/bash
for file in `find /home/test_copy/from_dir -mtime +2`
do
cp $file /home/test_copy/to_dir
done
#./copy_script1.sh    {all files from from_dir copied to to_dir directory, criteria being older than 2 days. The directory from_dir was not copied as shown below in the output of the script}
cp: omitting directory  `/home/test_copy/from_dir/'

Comments

Popular posts from this blog

VMware fix for Invalid manifest and ova file import failed errors

Session Timeout in Oracle Access Manager

SOAPUI - import certificate