worked version for directory based, besides of delete function