Finish the PUT method of webdav.

This commit is contained in:
zicla
2019-04-22 00:40:31 +08:00
parent ee9b049db4
commit 8632d7686b
5 changed files with 50 additions and 14 deletions

View File

@ -106,6 +106,20 @@ func GetDirOfPath(fullPath string) string {
return fullPath[:index]
}
//获取到一个Path 中的文件名eg /var/www/xx.log -> xx.log
func GetFilenameOfPath(fullPath string) string {
index1 := strings.LastIndex(fullPath, "/")
//可能是windows的环境
index2 := strings.LastIndex(fullPath, "\\")
index := index1
if index2 > index1 {
index = index2
}
return fullPath[index+1:]
}
//尝试删除空文件夹 true表示删掉了一个空文件夹false表示没有删掉任何东西
func DeleteEmptyDir(dirPath string) bool {
dir, err := ioutil.ReadDir(dirPath)