mirror of
https://github.com/mjl-/mox.git
synced 2024-12-27 08:53:48 +03:00
17 lines
269 B
Go
17 lines
269 B
Go
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
|
|
}
|