Last active
May 3, 2017 09:45
-
-
Save lopesivan/aa01cf2253af6198a895b1f3b801aed0 to your computer and use it in GitHub Desktop.
renomeando arquivos
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
================================================================ | |
Renomear todos os arquivos da árvore de diretórios | |
================================================================ | |
64 | |
Renomeia arquivos | |
================= | |
## Objetivo: | |
Renomear todos os arquivos da árvore de *basic -> skel* | |
~~~ | |
./js/basic.js ./js/skel.js | |
./sh/bash/basic.bash ./sh/bash/skel.bash | |
./sh/basic.sh.old ./sh/skel.sh.old | |
./sh/basic.sh --> ./sh/skel.sh | |
./awk/basic.awk ./awk/skel.awk | |
./c/basic.h ./c/skel.h | |
./c/basic.c ./c/skel.c | |
[...] [...] | |
./json/basic.json ./json/skel.json | |
./pl/basic.pl ./pl/skel.pl | |
~~~ | |
## Solução: | |
~~~ | |
$ find . -type f -name basic.\* | | |
sed -e 'G;P' \ | |
-e 's/basic/skel/' \ | |
-e 's/.*/&/' | | |
xargs -n2 echo "mv" | |
~~~ | |
para virar realidade adiciono um "sh" ao final ... | |
================================================================ | |
================================================================ | |
================================================================ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment