added check for existence of files and folders being added