move file operations in fileops.py