MCPcopy Create free account
hub / github.com/MertJSX/folderhost / GetDirectorySize

Function GetDirectorySize

utils/get_directory_size.go:11–23  ·  view source on GitHub ↗
(DirectoryPath string)

Source from the content-addressed store, hash-verified

9)
10
11func GetDirectorySize(DirectoryPath string) (int64, string, error) {
12 var size int64
13 err := filepath.Walk(DirectoryPath, func(_ string, info os.FileInfo, err error) error {
14 if err != nil {
15 return err
16 }
17 if !info.IsDir() {
18 size += info.Size()
19 }
20 return err
21 })
22 return size, ConvertBytesToString(size), err
23}
24
25func GetDirectorySizeAsync(DirectoryPath string, id int, ch chan<- types.DirectorySizeOutput, wg *sync.WaitGroup) {
26 defer wg.Done()

Callers 5

mainFunction · 0.92
DeleteFunction · 0.92
CreateCopyFunction · 0.92
GetRemainingFolderSpaceFunction · 0.85
GetDirectorySizeAsyncFunction · 0.85

Calls 1

ConvertBytesToStringFunction · 0.85

Tested by

no test coverage detected