package hybridBackup import ( "log" "path/filepath" "strings" ) /* Compare roots This script compare the files between two folder recursively */ //This function check which file exists in backup but not source drive func (t *BackupTask) compareRootPaths() ([]*RestorableFile, error) { results := []*RestorableFile{} //Check if the source and the backup disk exists fastWalk(t.DiskPath, func(filename string) error { rootAbs, _ := filepath.Abs(t.DiskPath) fileAbs, _ := filepath.Abs(filename) rootAbs = filepath.ToSlash(filepath.Clean(rootAbs)) fileAbs = filepath.ToSlash(filepath.Clean(fileAbs)) relPath := strings.ReplaceAll(fileAbs, rootAbs, "") assumedTargetPosition := filepath.Join(t.ParentPath, relPath) log.Println(assumedTargetPosition) return nil }) return results, nil }