TL;DR: I want all the 2.6s to say 2.7
lib
└── python2.6
└── site-packages
├── x
│ ├── x.py
│ ├── x.pyc
│ ├── __init__.py
│ ├── __init__.pyc
│ └── test
│ ├── __init__.py
│ └── __init__.pyc
└── x-0.2.0-py2.6.egg-info
├── dependency_links.txt
├── entry_points.txt
├── PKG-INFO
├── requires.txt
├── SOURCES.txt
└── top_level.txt
What I've tried:
find . -type d -name "*2.6*" -exec bash -c 'mv "$1" "${1/2.6/2.7}"' -- {} \;
Obviously this doesn't work because it sees the main folder, moves that, and then sees the nested folder and tries to move it, but it no longer exists in that spot and says no such file or directory
Is there a good way to do nested find and moves? In this case, I can just run the command twice and that would technically work, but it feels dirty.
Also, I know this could screw up the versioning of the package, or that I could do
find . -type d -name "*python2.6*" -exec bash -c 'mv "$1" "${1/2.6/2.7}"' -- {} \;
find . -type d -name "*py2.6*" -exec bash -c 'mv "$1" "${1/2.6/2.7}"' -- {} \;
But I'm more interested in learning if bash has a method to solve this in general than how to deal with this narrow scenario.