whatsapp-multi-devicewhatsapp-apiwhatsapprestgolanggorest-apigolang-whatsapp-apigolang-whatsappbotwhatsapp-web-multi-devicewhatsapp-api-go
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
30 lines
589 B
30 lines
589 B
package utils
|
|
|
|
import (
|
|
"os"
|
|
"path/filepath"
|
|
"time"
|
|
)
|
|
|
|
// RemoveFile is removing file with delay
|
|
func RemoveFile(delaySecond int, paths ...string) error {
|
|
if delaySecond > 0 {
|
|
time.Sleep(time.Duration(delaySecond) * time.Second)
|
|
}
|
|
|
|
for _, path := range paths {
|
|
err := os.Remove(path)
|
|
return err
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// CreateFolder create new folder and sub folder if not exist
|
|
func CreateFolder(folderPath ...string) error {
|
|
for _, folder := range folderPath {
|
|
newFolder := filepath.Join(".", folder)
|
|
err := os.MkdirAll(newFolder, os.ModePerm)
|
|
return err
|
|
}
|
|
return nil
|
|
}
|