commonutil.filefolder¶
檔案與資料夾輔助函式 / File and folder management routines
-
absjoin(*args)[source]¶ 由基底資料夾路徑與相對的檔案路徑建立絕對的檔案路徑
Make absolute path from path components
Parameters: *args – 基底資料夾路徑與相對於基底資料夾的檔案路徑等路徑元素 / path components Returns: 組合後的絕對路徑 / absolute path to file
-
chmod_folders(folder_path, mode=493)[source]¶ 變更資料夾與子資料夾的存取模式
Modify access bits of given folder recursively
Parameters: - folder_path – 資料夾路徑 / Folder path
- mode=DEFAULT_FOLDER_MODEBITS – 要設定的存取模式 / Access mode bits
-
make_folders(folder_path, mode=493)[source]¶ 準備/建立資料夾,當資料夾不存在時試圖建立資料夾
Make folder recursively with given access mode bit.
Parameters: folder_path – 要建立的資料夾路徑 / Path of folder to create Returns: True 當資料夾已存在或建立成功且可讀寫,或是 False 當資料夾存在但可能無法存取,若無法建立資料夾則會丟出例外 True if folder is successfully created and able to RWX. False if folder is created but may not able to RWX. An exception will be raised if failed to create folder.