目的は、木を探索し、エラーなしで木自体の名前(葉、枝、茎)を含むその木のすべてのものの名前を変更する手順を作成することです。
以下はツリー構造です(実際の例)。
[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
今まで私が持っているのはツリーを通して読み書きしてすべてのファイルの名前を変更するだけで、すべてのブランチ(ディレクトリ名)の名前ではなく、ツリーの基本名だと思っていました。 、Squeeze_9_Albums_FLAC_ANDYT1000_KAT
これは変更された唯一のディレクトリ名です。私たちが見ることができるように。
[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
そのために私が書いたスクリプトは次のとおりです。
#!/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
誰かがこれを見る必要があるかどうかはわかりませんが、万が一の場合に備えてここにいます。人々が終わりを見ると、エラーが発生し始める場所を見ることができます。 「既定のディレクトリ」の名前変更のため、ディレクトリが見つかりません。私はそれが何をしようとしたのかわかりません。
学期結果スニペット
[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
私はそれが何をすべきかを知っています。あるディレクトリ内のすべてのファイルを処理した後、同じ作業を実行するには、次のディレクトリに移動する前に、すべてのファイルが保存されている名前を変更する必要があります。その後、すべての操作が完了したら、そのデフォルトのディレクトリに移動し、以前と同様に名前を変更します。
私が誰かを混乱させなかったことを願っています。解決策を提示する前に慎重に考えてください。ありがとうございます。
答え1
-depth
findスイッチを試してください。
より多くの引用符を使用してください!
スペース/メタ文字を含むすべてのリテラルは「二重引用符」として扱われます。すべて拡張:"$var"
、、、、。"$(command "$var")"
コードやテキストについてはを参照してください。"${array[@]}"
"a & b"
'single quotes'
$'s: 'Costs $5 US'
ssh host 'echo "$HOSTNAME"'
http://mywiki.wooledge.org/Quotes
http://mywiki.wooledge.org/Arguments
http://wiki.bash-hackers.org/syntax/words