sorry to say, but you need to learn/read/try more by yourself ;-) so I wont deliver complete solutions anymore ^^
as a hint: you can achieve what you want to do with a single find command (and get rid of that whole for do crap).
some more hints:
find -type d
this simply will find all directories beneath the given path
find -cmin -120
this will give back only files/dirs with a change time within the last 120 minutes. read about differences between mmin and cmin (or mtime/ctime)... especially when this will happen to be updated on a dir. also mind the difference of using + or - modifier for the time given.
find -exec somecommand {} \;
this will execute a specified command on every single result of the search
after that combine this three stepwise into one single command. maybe use a non modifying command first as a dryrun method. append something like -print to get more output ;-)
Comments
PS: are you even aware under what circumstances a directory mtime or ctime is updated and when not?
tried (http://stackoverflow.com/a/552750) -120 minutes aka 2 hours but not works .. still getting all dirs
for dir in /home/blubbluh/*
do
if [ -d "${dir}" ]; then
if test
find "${dir}" -mmin -120
then
somecommandblahbleh
fi
fi
done
sorry to say, but you need to learn/read/try more by yourself ;-) so I wont deliver complete solutions anymore ^^
as a hint: you can achieve what you want to do with a single find command (and get rid of that whole for do crap).
some more hints:
this simply will find all directories beneath the given path
this will give back only files/dirs with a change time within the last 120 minutes. read about differences between mmin and cmin (or mtime/ctime)... especially when this will happen to be updated on a dir. also mind the difference of using + or - modifier for the time given.
this will execute a specified command on every single result of the search
after that combine this three stepwise into one single command. maybe use a non modifying command first as a dryrun method. append something like -print to get more output ;-)
Should have deferred to @Falzo but couldnt help it