in reply to Comparing two directories and then exiting from the script
if ($client_root ne $cwd) { #do something } [download]