mirror of
https://github.com/mjl-/mox.git
synced 2025-07-10 09:54:40 +03:00
mox!
This commit is contained in:
17
moxio/syncdir.go
Normal file
17
moxio/syncdir.go
Normal file
@ -0,0 +1,17 @@
|
||||
package moxio
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
)
|
||||
|
||||
// SyncDir opens a directory and syncs its contents to disk.
|
||||
func SyncDir(dir string) error {
|
||||
d, err := os.Open(dir)
|
||||
if err != nil {
|
||||
return fmt.Errorf("open directory: %v", err)
|
||||
}
|
||||
xerr := d.Sync()
|
||||
d.Close()
|
||||
return xerr
|
||||
}
|
Reference in New Issue
Block a user