complete file operation function