vBulletin Search Engine Optimization
| |||||||
| Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| ||||
| Hi i made a small script for placing my pictures on the internet. I don't know why but my camera makes the names now in CAPITALS... bv : IMG_2001.JPG but when i place it together with img_2000.jpg then my script doens't perform as wanted. Is there an easy command to change all the files in a dir (or even subdir) to non-capitals? Greetz Matata |
| |||
| On Thu, 16 Oct 2003 18:21:26 +0200, Matata <koen@NOSPAM.pi.be> wrote: >Hi i made a small script for placing my pictures on the internet. >I don't know why but my camera makes the names now in CAPITALS... > >bv : IMG_2001.JPG > >but when i place it together with img_2000.jpg then my script doens't >perform as wanted. > >Is there an easy command to change all the files in a dir (or even subdir) to >non-capitals? > >Greetz Matata Here's a link to one using awk: http://www.freeos.com/guides/lsst/scripts/up2low Google is your friend http://www.google.com/linux?sourceid...e+shell+script |
| ||||
| "Matata" <koen@NOSPAM.pi.be> wrote in message news > Hi i made a small script for placing my pictures on the internet. > I don't know why but my camera makes the names now in CAPITALS... > > bv : IMG_2001.JPG > > but when i place it together with img_2000.jpg then my script doens't > perform as wanted. > > Is there an easy command to change all the files in a dir (or even subdir) to > non-capitals? > > Greetz Matata You could try the following python program. I actually wrote it for windows (I was transferring files from W2K/NTFS to a FAT16 zip drive to a W98/FAT32 drive, and all the file names ended up horribly upper case), but it should work fine here. It runs recursively through directories. mvh. David #!/usr/bin/python # Program to change all file names to lower case, # recursing through all sub-directories. import os, os.path def HandleFile(f, d) : lw = f.lower() if f != lw : print "File %s%s -> %s" % (d, f, lw) os.rename(f, lw) def HandleDir(d, base = '') : lw = d.lower() if d != lw : print "Dir %s%s -> %s" % (base, d, lw) os.rename(d, lw) else : print "Dir %s%s" % (base, d) oldCwd = os.getcwd() os.chdir(d) dir = os.listdir('.') for f in dir : if os.path.isfile(f) : HandleFile(f, base + d + '/') if os.path.isdir(f) : HandleDir(f, base + d + '/') os.chdir(oldCwd) HandleDir('.') |