mhdi
asked on
bash script - when was folder last modified?
Hi,
I am writing a backup script for my VPS.
At the beginning of the script I need to check if "/backup/cpbackup/monthly" has been modified in the last 24 hours. If yes then do something.
This line
How do I get that date into a variable and then see if its < 24 hours old?
Thankyou
I am writing a backup script for my VPS.
At the beginning of the script I need to check if "/backup/cpbackup/monthly"
This line
find /backup/cpbackup/monthly/ -exec stat \{} --printf="%y\n" \; | sort -n -r | head -1
returns
2013-02-17 11:01:53.976116935 +1100
How do I get that date into a variable and then see if its < 24 hours old?
Thankyou
ASKER CERTIFIED SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.