Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Find and rename files in subdirs

Status
Not open for further replies.

mgump

Programmer
Apr 3, 2003
1
DE
Hello Scripting-Gurus,

I'am new in programming Unix shell-scripts.
Thats my problem,
I have to find and rename a large no. of jpg-files (2000-3000).This files and also the directories contains spaces
eq. /mp3/Alben/A -F/Fury In The Slaughterhouse/FrontA.jpg
find-arguments: filename contains (case insensitive) "front"
and not contains "back" and extension is ".jpg"
All matching files must be renamed to cover.jpg in their old directories.
I have read here a many threads but i can´t find a solution
for my problem. Has someone an idea ?

greets mgump

(Please excuse my "perfect" english)
 
for file in `find ...`
do case "$file" in *[fF][rR][oO][nN][tT]*)...
;; *) ...
;; esac
done
 
find /mp3 -name '*[fF][rR][oO][nN][tT]*jpg' -print | while read FILE
do
mv "$FILE" "$(dirname $FILE)/cover.jpg"
done
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top