Skip to content

Commit

Permalink
Merge pull request #20 from dufferzafar/mkdir
Browse files Browse the repository at this point in the history
Allow moving of files to subfolders
  • Loading branch information
Laurent Cozic committed Oct 11, 2015
2 parents 93264a8 + d87946c commit 3980d54
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ func (this *FileAction) FullOldPath() string {
}

func (this *FileAction) FullNewPath() string {
return normalizePath(filepath.Join(filepath.Dir(this.oldPath), filepath.Base(this.newPath)))
return normalizePath(filepath.Join(filepath.Dir(this.oldPath), filepath.Dir(this.newPath), filepath.Base(this.newPath)))
}

func (this *FileAction) String() string {
Expand Down Expand Up @@ -488,6 +488,7 @@ func processFileActions(fileActions []*FileAction, dryRun bool) error {
action.intermediatePath = action.FullNewPath() + "-" + u.String()
conflictActions = append(conflictActions, action)
} else {
os.MkdirAll(filepath.Dir(action.FullNewPath()), 0755);
err := os.Rename(action.FullOldPath(), action.FullNewPath())
if err != nil {
return err
Expand Down

0 comments on commit 3980d54

Please sign in to comment.