Fix tools/graduate.sh for work with directories

graduate.sh script works fine with files, but if we try create
new oslo library from existing directory, we get an
incorrect file structure.

For example if we run

 tools/graduate.sh foo openstack/common/foo/ tests/unit/test_foo/

We'll get file structure like

 oslo/foo/foo/file1.py

Added to graduate.sh `is directory` check to fix this issue.

Change-Id: Idd73288b12db54a44de14dbdef44fd8fd6617373
Merge "Fix tools/graduate.sh for work with directories"