1829992 Members
3183 Online
109998 Solutions
New Discussion

script

 
ivy1234
Frequent Advisor

script

Currently I have a script to move files from path A to path B , and a crontab will run this script daily , can advise if I want to have a condition to check if today is 1st of the daily , then do "xxx" , what can i do ? thx
2 REPLIES 2
ivy1234
Frequent Advisor

Re: script

sorry , not today is 1st ,

I would like to check is "file date is 1st" ( creation date or last modified date ) , can advise what can i do ? thx
DeafFrog
Valued Contributor

Re: script

Hi ,

i guess you are lokking for something like this :

logfile="Set_the _log_directory_path_here"
activedir="Set_directory_In_which_to_check"
for i in `ll $activedir | awk '{print $7}'`
do
if [ "$i" == 1 ];then
echo "This file that will be copied is $i " >> $logfile
cp #whad ever you want to do
fi
done

also , please search this forum ...you will find many a threads and script alredy yhere for this job.

Reg,
FrogIsDeaf