in reply to sleep() but don't exit

Just wrap the whole thing in a while (1) loop:
while (1) { while ( currenttime is between 11PM and 6AM ) { scan directory every hour send found files to other process } while( currenttime is not between 11PM and 6AM ) { sleep # whatever process you have here } }
Or am I reading this incorrectly?