while ( currenttime is between 11PM and 6AM ) { scan directory every hour send found files to other process } # this will bail out if the time range is no good, # rather than sleeping, so that's no good while (1) { same process } # just seems stupid although that could just be me # wanting to overcomplicate things