Hi,
I need to move files from one directory to another. There are sub-directories under AA directory. These subdirectories are named as 2 digit number. I need to read all these 2 digit name directories for a certain date range and move those files to /home/arc directory (parent, no subdirectory). There will be other directories as well, but I like to read only the ones that have naming convention of 2 digits only.
Also, I would like to put any error handling as well, in case if a directory is empty or doesnot have files for a certain date, then skip and move rest of the set of files. Are these any other sort of error handling you would when writing such shell scripts, please let me know.
========================================
cd /home/AA/10
mv *080706* /home/arc
mv *080806* /home/arc
cd /home/AA/12
mv *080706* /home/arc
mv *080806* /home/arc
cd /home/AA/45
mv *080706* /home/arc
mv *080806* /home/arc
cd /home/AA/82
mv *080706* /home/arc
mv *080806* /home/arc
========================================
In addition to this, if this can be done using cron, let's say delete all files those are 7 days old.
Thanks for all help.
Nick
I need to move files from one directory to another. There are sub-directories under AA directory. These subdirectories are named as 2 digit number. I need to read all these 2 digit name directories for a certain date range and move those files to /home/arc directory (parent, no subdirectory). There will be other directories as well, but I like to read only the ones that have naming convention of 2 digits only.
Also, I would like to put any error handling as well, in case if a directory is empty or doesnot have files for a certain date, then skip and move rest of the set of files. Are these any other sort of error handling you would when writing such shell scripts, please let me know.
========================================
cd /home/AA/10
mv *080706* /home/arc
mv *080806* /home/arc
cd /home/AA/12
mv *080706* /home/arc
mv *080806* /home/arc
cd /home/AA/45
mv *080706* /home/arc
mv *080806* /home/arc
cd /home/AA/82
mv *080706* /home/arc
mv *080806* /home/arc
========================================
In addition to this, if this can be done using cron, let's say delete all files those are 7 days old.
Thanks for all help.
Nick