Skip to content

Commit

Permalink
feat: Add 'recurse' flag to rename command for processing subdirectories
Browse files Browse the repository at this point in the history
  • Loading branch information
Laisky committed Dec 23, 2024
1 parent c811adf commit 59d4c4e
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion cmd/rename.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ func init() {
"exts", "e",
[]string{".mp4", ".avi", ".mov", "wmv", "rmvb"},
"files with these exts will be processed")
renameAvCmd.Flags().BoolVar(&renameAvCmdArgs.recurse,
"recurse", false, "recurse into subdirectories")
renameCMD.AddCommand(renameAvCmd)

renameFlatCmd.Flags().StringVarP(&renameFlatCmdArgs.dir,
Expand Down Expand Up @@ -214,7 +216,7 @@ var renameFlatCmd = &cobra.Command{
return errors.Wrapf(err, "get relative path of %s", path)
}

prefix := strings.Split(rel, string(os.PathSeparator))[0]
prefix := strings.TrimSpace(strings.Split(rel, string(os.PathSeparator))[0])
newName := prefix + "_" + filepath.Base(path)
targetPath := filepath.Join(baseDir, newName)
if renameFlatCmdArgs.dry {
Expand Down

0 comments on commit 59d4c4e

Please sign in to comment.