the Objective is to write a proccess that literates through a tree then change the names of everything within that tree including the names of the tree itself (the leafs, the branches, and trunk of the tree) without throwing an error.
this is the tree structor (a working example)
[userx@(none) ~]$ tree /home/userx/testing
/home/userx/testing
└── Squeeze - 9 Albums FLAC ANDYT1000 KAT
├── Argybargy
│ ├── 01. Pulling Mussels (From The Shell).flac
│ ├── 02. Another Nail In My Heart.flac
│ ├── 03. Separate Beds.flac
│ ├── 04. Misadventure.flac
│ ├── 05. I Think I'm Go Go.flac
│ ├── 06. Farfisa Beat.flac
│ ├── 07. Here Comes That Feeling.flac
│ ├── 08. Vicky Verky.flac
│ ├── 09. If I Didn't Love You.flac
│ ├── 10. Wrong Side Of The Moon.flac
│ ├── 11. There At The Top.flac
│ ├── 12. Funny How It Goes.flac
│ ├── 13. Go.flac
│ ├── Argybargy.cuetools.flac.cue
│ ├── Cover.jpg
│ └── artwork
│ ├── cover fold.jpg
│ ├── disc.jpg
│ ├── inlay.jpg
│ ├── inner fold.jpg
│ └── inner inlay.jpg
├── Big Squeeze - The Very Best Of
│ ├── CD 1
│ │ ├── 01 Squeeze - Take Me, I'm Yours.flac
│ │ ├── 02 Squeeze - Goodbye Girl.flac
│ │ ├── 03 Squeeze - Cool for Cats.flac
│ │ ├── 04 Squeeze - Up the Junction.flac
│ │ ├── 05 Squeeze - Slap & Tickle.flac
│ │ ├── 06 Squeeze - Another Nail in My Heart.flac
│ │ ├── 07 Squeeze - Pulling Mussels (From the Shell).flac
│ │ ├── 08 Squeeze - Is That Love.flac
│ │ ├── 09 Squeeze - Tempted.flac
│ │ ├── 10 Squeeze - Black Coffee in Bed.flac
│ │ ├── 11 Squeeze - Annie Get Your Gun.flac
│ │ ├── 12 Squeeze - Labelled with Love.flac
│ │ ├── 13 Squeeze - Last Time Forever.flac
│ │ ├── 14 Squeeze - Hourglass.flac
│ │ ├── 15 Squeeze - Some Fantastic Place.flac
│ │ ├── 16 Squeeze - Third Rail.flac
│ │ ├── 17 Squeeze - This Summer.flac
│ │ ├── 18 Squeeze - Electric Trains.flac
│ │ ├── 19 Squeeze - Heaven Knows.flac
│ │ ├── 20 Squeeze - Domino.flac
│ │ ├── CD 1.cuetools.flac.cue
│ │ └── Folder.jpg
│ └── CD 2 The B Sides
│ ├── 01 Squeeze - Suites from Five Strangers.flac
│ ├── 02 Squeeze - Squabs on Forty Fab.flac
│ ├── 03 Squeeze - Model.flac
│ ├── 04 Squeeze - Spanish Guitar.flac
│ ├── 05 Squeeze - Elephant Girl.flac
│ ├── 06 Squeeze - Trust.flac
│ ├── 07 Squeeze - Yap, Yap, Yap.flac
│ ├── 08 Squeeze - The Fortnight Saga.flac
│ ├── 09 Squeeze - Wedding Bells.flac
│ ├── 10 Squeeze - What the Butler Saw.flac
│ ├── 11 Squeeze - Going Crazy.flac
│ ├── 12 Squeeze - Introvert.flac
│ ├── 13 Squeeze - Who's That¿.flac
│ ├── 14 Squeeze - Vanity Fair.flac
│ ├── 15 Squeeze - Christmas Day.flac
│ ├── 16 Squeeze - Maidstone.flac
│ ├── 17 Squeeze - Discipline.flac
│ ├── 18 Squeeze - Periscope.flac
│ ├── 19 Squeeze - All's Well.flac
│ ├── CD 2 The B Sides.cd2.cuetools.flac.cue
│ └── Folder.jpg
├── Cool For Cats
│ ├── 01. Slap And Tickle.flac
│ ├── 02. Revue.flac
│ ├── 03. Touching Me Touching You.flac
│ ├── 04. It's Not Cricket.flac
│ ├── 05. It's So Dirty.flac
│ ├── 06. The Knack.flac
│ ├── 07. Hop Skip And Jump.flac
│ ├── 08. Up The Junction.flac
│ ├── 09. Hard To Find.flac
│ ├── 10. Slightly Drunk.flac
│ ├── 11. Goodbye Girl.flac
│ ├── 12. Cool For Cats.flac
│ ├── 13. I Must Go.flac
│ ├── 14. Ain't It Sad.flac
│ ├── Cool For Cats.cuetools.flac.cue
│ └── Cover.jpg
├── Cosi Fan Tutti Frutti
│ ├── 01. Big Beng.flac
│ ├── 02. By Your Side.flac
│ ├── 03. King George Street.flac
│ ├── 04. I Learnt How To Pray.flac
│ ├── 05. Last Time Forever.flac
│ ├── 06. No Place Like Home.flac
│ ├── 07. Heartbreaking World.flac
│ ├── 08. Hits Of The Year.flac
│ ├── 09. Break My Heart.flac
│ ├── 10. I Won't Ever Go Drinking Again.flac
│ ├── 11. Love's A Four Letter Word [Bonus].flac
│ ├── 12. The Fortnight Saga [Bonus].flac
│ ├── Cosi Fan Tutti Frutti.cuetools.flac.cue
│ └── Cover.jpg
├── Domino
│ ├── 01. Play On.flac
│ ├── 02. Bonkers.flac
│ ├── 03. What's Wrong With This Picture.flac
│ ├── 04. Domino.flac
│ ├── 05. To Be A Dad.flac
│ ├── 06. Donkey Talk.flac
│ ├── 07. Sleeping With A Friend.flac
│ ├── 08. Without You Here.flac
│ ├── 09. In The Morning.flac
│ ├── 10. A Moving Story.flac
│ ├── 11. Little King.flac
│ ├── 12. Short Break.flac
│ ├── Cover.jpg
│ └── Domino.cuetools.flac.cue
├── East Side Story
│ ├── 01. In Quintessence.flac
│ ├── 02. Someone Else's Heart.flac
│ ├── 03. Tempted.flac
│ ├── 04. Piccadilly.flac
│ ├── 05. There's No Tomorrow.flac
│ ├── 06. Heaven.flac
│ ├── 07. Woman's World.flac
│ ├── 08. Is That Love.flac
│ ├── 09. F-Hole.flac
│ ├── 10. Labelled With Love.flac
│ ├── 11. Someone Else's Bell.flac
│ ├── 12. Mumbo Jumbo.flac
│ ├── 13. Vanity Fair.flac
│ ├── 14. Messed Around.flac
│ ├── 15. The Axe Has Now Fallen [Bonus].flac
│ ├── 16. Looking For A Love [Bonus].flac
│ ├── Cover.jpg
│ └── East Side Story.cuetools.flac.cue
├── Piccadilly Collection
│ ├── 01. Everything In The World.flac
│ ├── 02. Some Fantastic Place.flac
│ ├── 03. Loving You Tonight.flac
│ ├── 04. If It's Love.flac
│ ├── 05. Within These Walls.flac
│ ├── 06. What The Butler Saw.flac
│ ├── 07. Squabs On The Forty Fab.flac
│ ├── 08. Pulling Mussels (From The Shell).flac
│ ├── 09. Hourglass.flac
│ ├── 10. Tempted.flac
│ ├── 11. Black Coffee In Bed.flac
│ ├── 12. Elephant Girl.flac
│ ├── 13. Spanish Guitar.flac
│ ├── 14. Annie Get Your Gun.flac
│ ├── 15. Love's Crashing Waves.flac
│ ├── 16. Hope Fell Down.flac
│ ├── 17. (This Could Be) The Last Time.flac
│ ├── 18. Last Time Forever.flac
│ ├── Cover.jpg
│ └── Piccadilly Collection.cuetools.flac.cue
├── Squeeze
│ ├── 01. Sex Master.flac
│ ├── 02. Bang Bang.flac
│ ├── 03. Strong In Reason.flac
│ ├── 04. Wild Sewerage Tickles Brazil.flac
│ ├── 05. Out Of Control.flac
│ ├── 06. Take Me, I'm Yours.flac
│ ├── 07. The Call.flac
│ ├── 08. Model.flac
│ ├── 09. Remember What.flac
│ ├── 10. First Thing Wrong.flac
│ ├── 11. Hesitation (Rool Britannia).flac
│ ├── 12. Get Smart.flac
│ ├── 13. Deep Cuts.flac
│ ├── 14. Heartbreak.flac
│ ├── Cover.jpg
│ ├── Squeeze.cuetools.flac.cue
│ └── artwork
│ ├── cover fold.jpg
│ ├── disc.jpg
│ ├── inlay.jpg
│ ├── inner fold.jpg
│ └── inner inlay.jpg
└── Sweets From A Stranger
├── 01. Out Of Touch.flac
├── 02. I Can't Hold On.flac
├── 03. Points Of View.flac
├── 04. Stranger Than The Stranger On The Shore.flac
├── 05. Onto The Dance Floor.flac
├── 06. When The Hangover Strikes.flac
├── 07. Black Coffee In Bed.flac
├── 08. I've Returned.flac
├── 09. Tongue Like A Knife.flac
├── 10. His House Her Home.flac
├── 11. The Very First Dance.flac
├── 12. The Elephant Ride.flac
├── 13. I Can't Get Up Anymore [Bonus].flac
├── 14. When Love Goes To Sleep [Bonus].flac
├── Cover.jpg
├── Sweets From A Stranger.cuetools.flac.cue
└── artwork
├── cover fold.jpg
├── disc.jpg
├── inlay.jpg
├── inner fold.jpg
└── inner inlay.jpg
15 directories, 187 files
what I have so far literates through the tree and changes the names of all of the files, but not the names of all of the branches (directory names) just the, I think it would be called is the basename of the tree being this one, Squeeze_9_Albums_FLAC_ANDYT1000_KAT
that is the only directory name that is changed. as we can see.
[userx@(none) ~]$ tree /home/userx/testing
/home/userx/testing
└── Squeeze_9_Albums_FLAC_ANDYT1000_KAT
├── Argybargy
│ ├── 01.-Pulling-Mussels-(From-The-Shell).flac
│ ├── 02.-Another-Nail-In-My-Heart.flac
│ ├── 03.-Separate-Beds.flac
│ ├── 04.-Misadventure.flac
│ ├── 05.-I-Think-I'm-Go-Go.flac
│ ├── 06.-Farfisa-Beat.flac
│ ├── 07.-Here-Comes-That-Feeling.flac
│ ├── 08.-Vicky-Verky.flac
│ ├── 09.-If-I-Didn't-Love-You.flac
│ ├── 10.-Wrong-Side-Of-The-Moon.flac
│ ├── 11.-There-At-The-Top.flac
│ ├── 12.-Funny-How-It-Goes.flac
│ ├── 13.-Go.flac
│ ├── Argybargy.cuetools.flac.cue
│ ├── Cover.jpg
│ └── artwork
│ ├── cover-fold.jpg
│ ├── disc.jpg
│ ├── inlay.jpg
│ ├── inner-fold.jpg
│ └── inner-inlay.jpg
├── Big Squeeze - The Very Best Of
│ ├── CD 1
│ │ ├── 01-Squeeze-Take-Me,-I'm-Yours.flac
│ │ ├── 02-Squeeze-Goodbye-Girl.flac
│ │ ├── 03-Squeeze-Cool-for-Cats.flac
│ │ ├── 04-Squeeze-Up-the-Junction.flac
│ │ ├── 05-Squeeze-Slap-&-Tickle.flac
│ │ ├── 06-Squeeze-Another-Nail-in-My-Heart.flac
│ │ ├── 07-Squeeze-Pulling-Mussels-(From-the-Shell).flac
│ │ ├── 08-Squeeze-Is-That-Love.flac
│ │ ├── 09-Squeeze-Tempted.flac
│ │ ├── 10-Squeeze-Black-Coffee-in-Bed.flac
│ │ ├── 11-Squeeze-Annie-Get-Your-Gun.flac
│ │ ├── 12-Squeeze-Labelled-with-Love.flac
│ │ ├── 13-Squeeze-Last-Time-Forever.flac
│ │ ├── 14-Squeeze-Hourglass.flac
│ │ ├── 15-Squeeze-Some-Fantastic-Place.flac
│ │ ├── 16-Squeeze-Third-Rail.flac
│ │ ├── 17-Squeeze-This-Summer.flac
│ │ ├── 18-Squeeze-Electric-Trains.flac
│ │ ├── 19-Squeeze-Heaven-Knows.flac
│ │ ├── 20-Squeeze-Domino.flac
│ │ ├── CD-1.cuetools.flac.cue
│ │ └── Folder.jpg
│ └── CD 2 The B Sides
│ ├── 01-Squeeze-Suites-from-Five-Strangers.flac
│ ├── 02-Squeeze-Squabs-on-Forty-Fab.flac
│ ├── 03-Squeeze-Model.flac
│ ├── 04-Squeeze-Spanish-Guitar.flac
│ ├── 05-Squeeze-Elephant-Girl.flac
│ ├── 06-Squeeze-Trust.flac
│ ├── 07-Squeeze-Yap,-Yap,-Yap.flac
│ ├── 08-Squeeze-The-Fortnight-Saga.flac
│ ├── 09-Squeeze-Wedding-Bells.flac
│ ├── 10-Squeeze-What-the-Butler-Saw.flac
│ ├── 11-Squeeze-Going-Crazy.flac
│ ├── 12-Squeeze-Introvert.flac
│ ├── 13-Squeeze-Who's-That¿.flac
│ ├── 14-Squeeze-Vanity-Fair.flac
│ ├── 15-Squeeze-Christmas-Day.flac
│ ├── 16-Squeeze-Maidstone.flac
│ ├── 17-Squeeze-Discipline.flac
│ ├── 18-Squeeze-Periscope.flac
│ ├── 19-Squeeze-All's-Well.flac
│ ├── CD-2-The-B-Sides.cd2.cuetools.flac.cue
│ └── Folder.jpg
├── Cool For Cats
│ ├── 01.-Slap-And-Tickle.flac
│ ├── 02.-Revue.flac
│ ├── 03.-Touching-Me-Touching-You.flac
│ ├── 04.-It's-Not-Cricket.flac
│ ├── 05.-It's-So-Dirty.flac
│ ├── 06.-The-Knack.flac
│ ├── 07.-Hop-Skip-And-Jump.flac
│ ├── 08.-Up-The-Junction.flac
│ ├── 09.-Hard-To-Find.flac
│ ├── 10.-Slightly-Drunk.flac
│ ├── 11.-Goodbye-Girl.flac
│ ├── 12.-Cool-For-Cats.flac
│ ├── 13.-I-Must-Go.flac
│ ├── 14.-Ain't-It-Sad.flac
│ ├── Cool-For-Cats.cuetools.flac.cue
│ └── Cover.jpg
├── Cosi Fan Tutti Frutti
│ ├── 01.-Big-Beng.flac
│ ├── 02.-By-Your-Side.flac
│ ├── 03.-King-George-Street.flac
│ ├── 04.-I-Learnt-How-To-Pray.flac
│ ├── 05.-Last-Time-Forever.flac
│ ├── 06.-No-Place-Like-Home.flac
│ ├── 07.-Heartbreaking-World.flac
│ ├── 08.-Hits-Of-The-Year.flac
│ ├── 09.-Break-My-Heart.flac
│ ├── 10.-I-Won't-Ever-Go-Drinking-Again.flac
│ ├── 11.-Love's-A-Four-Letter-Word-[Bonus].flac
│ ├── 12.-The-Fortnight-Saga-[Bonus].flac
│ ├── Cosi-Fan-Tutti-Frutti.cuetools.flac.cue
│ └── Cover.jpg
├── Domino
│ ├── 01.-Play-On.flac
│ ├── 02.-Bonkers.flac
│ ├── 03.-What's-Wrong-With-This-Picture.flac
│ ├── 04.-Domino.flac
│ ├── 05.-To-Be-A-Dad.flac
│ ├── 06.-Donkey-Talk.flac
│ ├── 07.-Sleeping-With-A-Friend.flac
│ ├── 08.-Without-You-Here.flac
│ ├── 09.-In-The-Morning.flac
│ ├── 10.-A-Moving-Story.flac
│ ├── 11.-Little-King.flac
│ ├── 12.-Short-Break.flac
│ ├── Cover.jpg
│ └── Domino.cuetools.flac.cue
├── East Side Story
│ ├── 01.-In-Quintessence.flac
│ ├── 02.-Someone-Else's-Heart.flac
│ ├── 03.-Tempted.flac
│ ├── 04.-Piccadilly.flac
│ ├── 05.-There's-No-Tomorrow.flac
│ ├── 06.-Heaven.flac
│ ├── 07.-Woman's-World.flac
│ ├── 08.-Is-That-Love.flac
│ ├── 09.-F-Hole.flac
│ ├── 10.-Labelled-With-Love.flac
│ ├── 11.-Someone-Else's-Bell.flac
│ ├── 12.-Mumbo-Jumbo.flac
│ ├── 13.-Vanity-Fair.flac
│ ├── 14.-Messed-Around.flac
│ ├── 15.-The-Axe-Has-Now-Fallen-[Bonus].flac
│ ├── 16.-Looking-For-A-Love-[Bonus].flac
│ ├── Cover.jpg
│ └── East-Side-Story.cuetools.flac.cue
├── Piccadilly Collection
│ ├── 01.-Everything-In-The-World.flac
│ ├── 02.-Some-Fantastic-Place.flac
│ ├── 03.-Loving-You-Tonight.flac
│ ├── 04.-If-It's-Love.flac
│ ├── 05.-Within-These-Walls.flac
│ ├── 06.-What-The-Butler-Saw.flac
│ ├── 07.-Squabs-On-The-Forty-Fab.flac
│ ├── 08.-Pulling-Mussels-(From-The-Shell).flac
│ ├── 09.-Hourglass.flac
│ ├── 10.-Tempted.flac
│ ├── 11.-Black-Coffee-In-Bed.flac
│ ├── 12.-Elephant-Girl.flac
│ ├── 13.-Spanish-Guitar.flac
│ ├── 14.-Annie-Get-Your-Gun.flac
│ ├── 15.-Love's-Crashing-Waves.flac
│ ├── 16.-Hope-Fell-Down.flac
│ ├── 17.-(This-Could-Be)-The-Last-Time.flac
│ ├── 18.-Last-Time-Forever.flac
│ ├── Cover.jpg
│ └── Piccadilly-Collection.cuetools.flac.cue
├── Squeeze
│ ├── 01.-Sex-Master.flac
│ ├── 02.-Bang-Bang.flac
│ ├── 03.-Strong-In-Reason.flac
│ ├── 04.-Wild-Sewerage-Tickles-Brazil.flac
│ ├── 05.-Out-Of-Control.flac
│ ├── 06.-Take-Me,-I'm-Yours.flac
│ ├── 07.-The-Call.flac
│ ├── 08.-Model.flac
│ ├── 09.-Remember-What.flac
│ ├── 10.-First-Thing-Wrong.flac
│ ├── 11.-Hesitation-(Rool-Britannia).flac
│ ├── 12.-Get-Smart.flac
│ ├── 13.-Deep-Cuts.flac
│ ├── 14.-Heartbreak.flac
│ ├── Cover.jpg
│ ├── Squeeze.cuetools.flac.cue
│ └── artwork
│ ├── cover-fold.jpg
│ ├── disc.jpg
│ ├── inlay.jpg
│ ├── inner-fold.jpg
│ └── inner-inlay.jpg
└── Sweets From A Stranger
├── 01.-Out-Of-Touch.flac
├── 02.-I-Can't-Hold-On.flac
├── 03.-Points-Of-View.flac
├── 04.-Stranger-Than-The-Stranger-On-The-Shore.flac
├── 05.-Onto-The-Dance-Floor.flac
├── 06.-When-The-Hangover-Strikes.flac
├── 07.-Black-Coffee-In-Bed.flac
├── 08.-I've-Returned.flac
├── 09.-Tongue-Like-A-Knife.flac
├── 10.-His-House-Her-Home.flac
├── 11.-The-Very-First-Dance.flac
├── 12.-The-Elephant-Ride.flac
├── 13.-I-Can't-Get-Up-Anymore-[Bonus].flac
├── 14.-When-Love-Goes-To-Sleep-[Bonus].flac
├── Cover.jpg
├── Sweets-From-A-Stranger.cuetools.flac.cue
└── artwork
├── cover-fold.jpg
├── disc.jpg
├── inlay.jpg
├── inner-fold.jpg
└── inner-inlay.jpg
15 directories, 187 files
this is the script I wrote to do this:
#!/bin/bash
#tues dec-29-2015
typeset -i Afiles count
let Afiles=0 count=0
echo ; echo ; echo
working_dir="$HOME/testing"
script_dir="$HOME/scripts"
AmountDirs="$(find "$working_dir" -mindepth 1 -type d | wc -l)"
find "$working_dir" -mindepth 1 -type d | while [[ $AmountDirs -gt $count ]] ;
do read DIRNAME;
if [[ -z "$DIRNAME" ]] ; then
echo "DIRNAME "$DIRNAME" is empty Yo"
exit 0
fi
PDIR=${DIRNAME%/*}
DIR=${DIRNAME##*/}
#clean up names according to what ever user wants to remove first
DIR=${DIR%@*}
DIR=${DIR//-/ }
DIR=${DIR//_/ }
#ensure only one space between each word
DIR="$(echo -e "${DIR}" | fmt -u )"
#removes leading white space on both ends of string
DIR="$(echo -e "${DIR}" | sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//')"
#add to name what ever user wants to here
DIR=${DIR// /_}
#get list of all files in dir and sub dir's of current Dir to work off of
MAX="$(find "$DIRNAME" -type f -name "*.*" | wc -l)"
find "$DIRNAME" -type f -name "*.*" | while [ $Afiles -ne $MAX ] ;
do read FILENAME;
f=$FILENAME
path=${f%/*}
xfile=${f##*/}
title=${xfile%.*}
ext=${xfile##*.}
#clean up names according to what ever user wants to remove first
title=${title//-/ }
#ensure only one space between each word
title="$(echo -e "${title}" | fmt -u )"
#removes leading white space on both ends of string
title="$(echo -e "${title}" | sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//')"
#add to name what ever user wants to here
title=${title// /-}
newTitle="$title"."$ext"
let Afiles++
echo
mv -v "$FILENAME" "$path"/"$newTitle"
done
echo
mv -v "$DIRNAME" "$PDIR"/"$DIR"
echo
let count++
done
I am not sure if one needs to see this but here it is just incase. If one looks at the end part of it, they will see where it is starting to throw errors -- dir not found, due to that "base dir" name change. I have no idea what it is trying to do at that point.
Sniplet of results on term
[userx@(none) scripts]$ ./changeTreeNames
mv: ‘/home/userx/testing/Squeeze - 9 Albums FLAC ANDYT1000 KAT/Domino/Cover.jpg’ and ‘/home/userx/testing/Squeeze - 9 Albums FLAC ANDYT1000 KAT/Domino/Cover.jpg’ are the same file
‘/home/userx/testing/Squeeze - 9 Albums FLAC ANDYT1000 KAT/Domino/01. Play On.flac’ -> ‘/home/userx/testing/Squeeze - 9 Albums FLAC ANDYT1000 KAT/Domino/01.-Play-On.flac’
‘/home/userx/testing/Squeeze - 9 Albums FLAC ANDYT1000 KAT/Big Squeeze - The Very Best Of/CD 2 The B Sides/19 Squeeze - All's Well.flac’ -> ‘/home/userx/testing/Squeeze - 9 Albums FLAC ANDYT1000 KAT/Big Squeeze - The Very Best Of/CD 2 The B Sides/19-Squeeze-All's-Well.flac’
‘/home/userx/testing/Squeeze - 9 Albums FLAC ANDYT1000 KAT/Big Squeeze - The Very Best Of/CD 2 The B Sides/10 Squeeze - What the Butler Saw.flac’ -> ‘/home/userx/testing/Squeeze - 9 Albums FLAC ANDYT1000 KAT/Big Squeeze - The Very Best Of/CD 2 The B Sides/10-Squeeze-What-the-Butler-Saw.flac’
mv: cannot stat ‘/home/userx/testing/Squeeze - 9 Albums FLAC ANDYT1000 KAT/Big Squeeze - The Very Best Of’: No such file or directory
find: ‘/home/userx/testing/Squeeze - 9 Albums FLAC ANDYT1000 KAT/Big Squeeze - The Very Best Of/CD 2 The B Sides’: No such file or directory
find: ‘/home/userx/testing/Squeeze - 9 Albums FLAC ANDYT1000 KAT/Big Squeeze - The Very Best Of/CD 2 The B Sides’: No such file or directory
mv: cannot stat ‘/home/userx/testing/Squeeze - 9 Albums FLAC ANDYT1000 KAT/Big Squeeze - The Very Best Of/CD 2 The B Sides’: No such file or directory
find: ‘/home/userx/testing/Squeeze - 9 Albums FLAC ANDYT1000 KAT/Big Squeeze - The Very Best Of/CD 1’: No such file or directory
find: ‘/home/userx/testing/Squeeze - 9 Albums FLAC ANDYT1000 KAT/Big Squeeze - The Very Best Of/CD 1’: No such file or directory
mv: cannot stat ‘/home/userx/testing/Squeeze - 9 Albums FLAC ANDYT1000 KAT/Big Squeeze - The Very Best Of/CD 1’: No such file or directory
find: ‘/home/userx/testing/Squeeze - 9 Albums FLAC ANDYT1000 KAT/Piccadilly Collection’: No such file or directory
find: ‘/home/userx/testing/Squeeze - 9 Albums FLAC ANDYT1000 KAT/Piccadilly Collection’: No such file or directory
mv: cannot stat ‘/home/userx/testing/Squeeze - 9 Albums FLAC ANDYT1000 KAT/Piccadilly Collection’: No such file or directory
find: ‘/home/userx/testing/Squeeze - 9 Albums FLAC ANDYT1000 KAT/Cosi Fan Tutti Frutti’: No such file or directory
find: ‘/home/userx/testing/Squeeze - 9 Albums FLAC ANDYT1000 KAT/Cosi Fan Tutti Frutti’: No such file or directory
mv: cannot stat ‘/home/userx/testing/Squeeze - 9 Albums FLAC ANDYT1000 KAT/Cosi Fan Tutti Frutti’: No such file or directory
I know what it needs to do, after it gets done with all of the files within one directory then it needs to change that name that held all of them files first before moving on to the next directory to do the same. then when it has complete all of the then go to that basedir and change the name of that, not before like it is doing.
I do hope I have not confused anyone, chew on it for a bit before trying to give me your solution please, and thanks
-depth
directive tofind
will take you a long way towards your goal. – glenn jackman Dec 30 '15 at 23:17find
command with a-exec rename
operator and a regex passed to rename. If you're on RHEL/CentOS, still check that link, but you have a different version of rename and might still need your uber-long script. EDIT: Actually you will never ever ever need to do this much string parsing by juggling bash variables. Just usesed
for that part. – Wildcard Dec 31 '15 at 00:12