Closed fabienfoerster closed 5 years ago
Should sort what it can, the rest of the video files should in a subfolder toSort, and erase everything in the source folder...
func RemoveContents(dir string) error {
d, err := os.Open(dir)
if err != nil {
return err
}
defer d.Close()
names, err := d.Readdirnames(-1)
if err != nil {
return err
}
for _, name := range names {
err = os.RemoveAll(filepath.Join(dir, name))
if err != nil {
return err
}
}
return nil
}
When the sorting is finish, the source folder may contain a lot of folder that don't contain anything useful. So we must rid of them !