Link to home
Create AccountLog in
Avatar of mhdi
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
find /backup/cpbackup/monthly/ -exec stat \{} --printf="%y\n" \; | sort -n -r | head -1

Open in new window

returns
2013-02-17 11:01:53.976116935 +1100

Open in new window


How do I get that date into a variable and then see if its < 24 hours old?

Thankyou
ASKER CERTIFIED SOLUTION
Avatar of woolmilkporc
woolmilkporc
Flag of Germany image

Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
See answer
SOLUTION
Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.