Use rename() instead of shell call for renaming directories.