make bash script recursive in current directory
by lleb from LinuxQuestions.org on (#59QZV)
what do i need to add to the following code
Code:#!/bin/bash
#for i in ./*old_string*; do mv -- "$i" "${i//old_string/new_string_here}"; done
for i in ./*\ -\ *; do mv -- "$i" "${i//\ -\ /-}"; done
for i in ./*\ *; do mv -- "$i" "${i//\ /.}"; done
for i in ./*\ \(*; do mv -- "$i" "${i//\ \(/}"; done
for i in ./*\(*; do mv -- "$i" "${i//\(/}"; done
for i in ./*\)*; do mv -- "$i" "${i//\)/}"; done
for i in ./*\[*; do mv -- "$i" "${i//\[/}"; done
for i in ./*\]*; do mv -- "$i" "${i//\]/}"; doneSimple code that cleans up file names and removes many of the non-standard spaces or characters found in many MS Windows files names either created by MS, vendors, or end users.
Goal: Be able to run this in a directory and have it drill down into sub-directories, but not go up directories.
ex: current path: /home/user/foo
run in there and touch all files and directory names recursively.
Thank you in advance.


Code:#!/bin/bash
#for i in ./*old_string*; do mv -- "$i" "${i//old_string/new_string_here}"; done
for i in ./*\ -\ *; do mv -- "$i" "${i//\ -\ /-}"; done
for i in ./*\ *; do mv -- "$i" "${i//\ /.}"; done
for i in ./*\ \(*; do mv -- "$i" "${i//\ \(/}"; done
for i in ./*\(*; do mv -- "$i" "${i//\(/}"; done
for i in ./*\)*; do mv -- "$i" "${i//\)/}"; done
for i in ./*\[*; do mv -- "$i" "${i//\[/}"; done
for i in ./*\]*; do mv -- "$i" "${i//\]/}"; doneSimple code that cleans up file names and removes many of the non-standard spaces or characters found in many MS Windows files names either created by MS, vendors, or end users.
Goal: Be able to run this in a directory and have it drill down into sub-directories, but not go up directories.
ex: current path: /home/user/foo
run in there and touch all files and directory names recursively.
Thank you in advance.