I am trying to rename files and append their parent directory name to them (and move them to a new folder named Photos).
I've been trying to do this with rename and mmv, but I am having difficulties doing this when standing inside directory A in the example below.
$ pwd
/A
$ tree
.
├── 1.jpg
├── 2.jpg
└── 3.jpg
But it works fine when running rename from one step higher up in the folder hierarchy.
$ pwd
/
$ tree
.
└── A
├── 1.jpg
├── 2.jpg
└── 3.jpg
$ rename 's|(.*)/(.*)|$1/Photos/$1 - $2|' */*.jpg -p
$ tree
.
└── A
└── Photos
├── A\ -\ 1.jpg
├── A\ -\ 2.jpg
└── A\ -\ 3.jpg
How can this be accomplished when standing in directory 'A' in the example?