Handle single files and directories