Added check for empty field output values
Created separate file for operating on files and directories