Updated for other types of files and folder.