whoa heres a big one -- ftp and scripting

coastal593

Registered
so heres what i want to do ...

i have folder that is organized into bands and albums etc ... and there are a LOT of bands and albums, about 100 gigs of mp3s total. i would love it if someone knew how to write a script that might do any or all of these things ...

1.) find all .DS_Store, .FBCIndex files and .FBCLockFolder folder and delete them ALL! within a specified directory.

2.) change all the permissions of the folder and everything inside it to a certain user (me, an administrator) -- ok so this one is easy but i'd want it incorporated into the script

3.) although i dont know if its possible, capatalize all first letters of all words in the folder titles (there are at least 2000 folders organizing all of this).

if any or all of this is possible, i would sure appreciate some help.

thanks!
 
merry xmas :)

3 simple scripts given below. Just change to relevent path info etc. I ran it quick, worked fine on my system, but ofcourse, you'll get no warrantee from me :)

--------- foo.sh --------------------
#!/bin/sh
USER=youruser
FOLDER=/tmp
for x in .DS_Store .FBCIndex .FBCLockFolder; do
find $FOLDER -name $x -exec rm -f {} \;
done
chown -R $USER $FOLDER
find $FOLDER -follow -type d -exec /tmp/moveupper.sh {} \;


--------- moveupper.sh ------------------
#!/bin/sh
newname=`echo $1 | /tmp/runcapscript.sed`
mv $1 $newname


------ runcapscript.sed -------------------
#!/usr/bin/sed -f

s/^/ /
:loop
h
s/.*[^a-zA-Z0-9]\([a-z]\).*/\1/
/../{
s/^[^a-zA-Z0-9]\(.*\)/\1/
b
}
y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/
G
s/\(.\)\n\(.*[^a-zA-Z0-9]\)[a-z]/\2\1/
tloop


-------------------------------------------------------

Brian
 
Back
Top