Skip to main content
added 15 characters in body
Source Link
pLumo
  • 23.2k
  • 2
  • 43
  • 70

Instead of xargs and mv, I would prefer rename tool:

Depending on which rename tool you have:

find ~/Downloads/Scala_Intro -name '*  *' -exec rename -n '  ' ' ' {} +

or

find ~/Downloads/Scala_Intro -name '*  *' -exec rename -n 's/  / /' {} +

(Remove -n option (dry-run) to runactually perform the renamerenaming if you're happy with the output)


Or if you want to stick using mv (no xargs needed, find -exec will do):

find ~/Downloads/Scala_Intro -name '*  *' -exec sh -c 'mv "$1" "${1//  / }"' find-sh {} \;

Instead of xargs and mv, I would prefer rename tool:

Depending on which rename tool you have:

find ~/Downloads/Scala_Intro -name '*  *' -exec rename -n '  ' ' ' {} +

or

find ~/Downloads/Scala_Intro -name '*  *' -exec rename -n 's/  / /' {} +

(Remove -n option (dry-run) to run the rename if you're happy with the output)


Or if you want to stick using mv (no xargs needed, find -exec will do):

find ~/Downloads/Scala_Intro -name '*  *' -exec sh -c 'mv "$1" "${1//  / }"' find-sh {} \;

Instead of xargs and mv, I would prefer rename tool:

Depending on which rename tool you have:

find ~/Downloads/Scala_Intro -name '*  *' -exec rename -n '  ' ' ' {} +

or

find ~/Downloads/Scala_Intro -name '*  *' -exec rename -n 's/  / /' {} +

(Remove -n option (dry-run) to actually perform the renaming if you're happy with the output)


Or if you want to stick using mv (no xargs needed, find -exec will do):

find ~/Downloads/Scala_Intro -name '*  *' -exec sh -c 'mv "$1" "${1//  / }"' find-sh {} \;
Source Link
pLumo
  • 23.2k
  • 2
  • 43
  • 70

Instead of xargs and mv, I would prefer rename tool:

Depending on which rename tool you have:

find ~/Downloads/Scala_Intro -name '*  *' -exec rename -n '  ' ' ' {} +

or

find ~/Downloads/Scala_Intro -name '*  *' -exec rename -n 's/  / /' {} +

(Remove -n option (dry-run) to run the rename if you're happy with the output)


Or if you want to stick using mv (no xargs needed, find -exec will do):

find ~/Downloads/Scala_Intro -name '*  *' -exec sh -c 'mv "$1" "${1//  / }"' find-sh {} \;