bash - Git recursive mv files -


i'm trying add version numbers javascript files in directory changes files won't cached our users.

how can move javascript files in several directories within 1 directory?

with example file structure:

js/ --home/ ----main.js --apps/ ----main.js --handlers.js --ajax.js 

i git mv -r js/*.js js/*.1.js append .1 filenames. there isn't flag recursion git mv, i'm wondering options similar.

globstar (bash >=4)

shopt -s globstar # set shell option globstar f in **/*.js;   git mv "$f" "${f%.js}.$version.js" done 

to move single directory:

for source in **/*.js;   dest="${source%.js}.$version.js"   dest="$destination/${dest##*/}" # strip off leading directories , prepend actual destination   git mv "$source" "$dest" done 

find

you can use find, it's same, save need bash 3 or posix sh portability (os x, example).

find . -iname '*.js' -exec sh -c 'for f;   git mv "$f" "${f%.js}.$version.js" done' _ {} + 

Comments

Popular posts from this blog

user interface - How to replace the Python logo in a Tkinter-based Python GUI app? -

objective c - Greedy NSProgressIndicator Allocation -

how to set an OCR language in Google Drive -