BASH: Getting parent folder name
by dezix from LinuxQuestions.org on (#4SF91)
Hello!
in a folder I have automatically named files, i. e.:
ls my_repo
file000 file001 ...
with a bash script, I would like to change the name of these files to:
my_repo000 my_repo001 ...
Assuming I work recursively on a tree structure,
maybe with the "find" command to select specific sets of files.
What should be a simple way to get only the names of the parent folders (not the complete or relative path as "dirname" do)?
Thanks for the help.


in a folder I have automatically named files, i. e.:
ls my_repo
file000 file001 ...
with a bash script, I would like to change the name of these files to:
my_repo000 my_repo001 ...
Assuming I work recursively on a tree structure,
maybe with the "find" command to select specific sets of files.
What should be a simple way to get only the names of the parent folders (not the complete or relative path as "dirname" do)?
Thanks for the help.