Fixing rename issue.

       * Since, we rely on the directory structure, directory
         names should be retained.
       * Bug was not considering complete path while checking for
         isdir, which would always be False.

Signed-off-by: Vijaykumar Koppad <vijaykumar.koppad@gmail.com>