Python script to print directories and write them in a log file (Cross Platform)