Article 4SF91 BASH: Getting parent folder name

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.latest?d=yIl2AUoC8zA latest?i=1Lii109qdD8:BUlrnqEU47c:F7zBnMy latest?i=1Lii109qdD8:BUlrnqEU47c:V_sGLiP latest?d=qj6IDK7rITs latest?i=1Lii109qdD8:BUlrnqEU47c:gIN9vFw1Lii109qdD8
External Content
Source RSS or Atom Feed
Feed Location https://feeds.feedburner.com/linuxquestions/latest
Feed Title LinuxQuestions.org
Feed Link https://www.linuxquestions.org/questions/
Reply 0 comments