github.com/fzfile/BaiduPCS-Go@v0.0.0-20200606205115-4408961cf336/baidupcs/rm_mkdir.go (about) 1 package baidupcs 2 3 import ( 4 "github.com/fzfile/BaiduPCS-Go/baidupcs/pcserror" 5 "path" 6 ) 7 8 // Remove 批量删除文件/目录 9 func (pcs *BaiduPCS) Remove(paths ...string) (pcsError pcserror.Error) { 10 dataReadCloser, pcsError := pcs.PrepareRemove(paths...) 11 if pcsError != nil { 12 return 13 } 14 15 defer dataReadCloser.Close() 16 17 errInfo := pcserror.DecodePCSJSONError(OperationRemove, dataReadCloser) 18 if errInfo != nil { 19 return errInfo 20 } 21 22 // 更新缓存 23 pcs.deleteCache(allRelatedDir(paths)) 24 return nil 25 } 26 27 // Mkdir 创建目录 28 func (pcs *BaiduPCS) Mkdir(pcspath string) (pcsError pcserror.Error) { 29 dataReadCloser, pcsError := pcs.PrepareMkdir(pcspath) 30 if pcsError != nil { 31 return 32 } 33 34 defer dataReadCloser.Close() 35 36 errInfo := pcserror.DecodePCSJSONError(OperationMkdir, dataReadCloser) 37 if errInfo != nil { 38 return errInfo 39 } 40 41 // 更新缓存 42 pcs.deleteCache([]string{path.Dir(pcspath)}) 43 return 44 }