shell - bash rename files issue? -
i know nothing linux commands o bash scripts me please. have lot of file in different directories want rename files "name" "name.xml" using bash file possible that? find usefulness codes on internet this:
shopt -s globstar # enable ** globstar/recursivity in **/*.txt; echo "$i" "${i/%.txt}.xml"; done
it not work.
explanation
move/rename files –whatever extension is– in current directory , below name
name.xml
. should test using echo
before running real script.
shopt -s globstar # enable ** globstar/recursivity in **; # **/*.txt .txt files [[ -d "$i" ]] && continue # skip directories echo "$i" "$i.xml"; # replace 'echo' 'mv' when validated #echo "$i" "${i/%.txt}.xml"; # replace .txt .xml done
Comments
Post a Comment