allow to pass a directory as target path