
# mox.file与本地接口的对应关系和切换
#### API对应关系
- Python：指本地使用Python对本地文件的操作接口。支持一键切换为对应的MoXing文件操作接口（mox.file）。
- mox.file：指MoXing框架中用于文件操作的接口，与Python接口具有一一对应的关系。
- tf.gfile：指MoXing文件操作接口一一对应的TensorFlow相同功能的接口，在MoXing中，文件操作接口不会自动切换为TensorFlow的接口，下表呈现内容仅表示功能类似，帮助您更快速地了解MoXing文件操作接口的功能。
表1API对应关系 
| Python（本地文件操作接口） | mox.file（MoXing文件操作接口）                          | tf.gfile（TensorFlow文件操作接口）         |
|:---|:---|:---|
| glob.glob        | mox.file.glob                                   | tf.gfile.Glob                      |
| os.listdir       | mox.file.list_directory(..., recursive=False)   | tf.gfile.ListDirectory             |
| os.makedirs      | mox.file.make_dirs                              | tf.gfile.MakeDirs                  |
| os.mkdir         | mox.file.mk_dir                                 | tf.gfile.MkDir                     |
| os.path.exists   | mox.file.exists                                 | tf.gfile.Exists                    |
| os.path.getsize  | mox.file.get_size                               | -                                  |
| os.path.isdir    | mox.file.is_directory                           | tf.gfile.IsDirectory               |
| os.remove        | mox.file.remove(..., recursive=False)           | tf.gfile.Remove                    |
| os.rename        | mox.file.rename                                 | tf.gfile.Rename                    |
| os.scandir       | mox.file.scan_dir                               | -                                  |
| os.stat          | mox.file.stat(在低于2.5.0版本的moxing中st_mtime属性存在问题) | tf.gfile.Stat                      |
| os.walk          | mox.file.walk                                   | tf.gfile.Walk                      |
| open             | mox.file.File                                   | tf.gfile.FastGFile(tf.gfile.Gfile) |
| shutil.copyfile  | mox.file.copy                                   | tf.gfile.Copy                      |
| shutil.copytree  | mox.file.copy_parallel                          | -                                  |
| shutil.rmtree    | mox.file.remove(..., recursive=True)            | tf.gfile.DeleteRecursively         |
   
