Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

simple file copy program

Name: Anonymous 2010-01-18 23:35

need a bash script or python to copy files in batches of 500 and put them into subdirectories

there can be any number of files (I have 15k), and the filenames are irrelevant, and the names of the subdirectories that are created to house the files is irrelevant

here's what I was trying to get work in python but it
errors out at file 339, don't know why



def BreakUp(indir):
   
    biglist = glob.glob('*.mp3')
    dircount = 0
    filecount = 0

    while biglist:
        dircount += 1
        os.mkdir('subdir'+str(dircount))
        for i in range(500):   
            filecount += 1
            try:
                src = biglist[filecount].translate("(copy)")
                os.system ("mv"+ " " + src + " subdir"+ str(dircount))          
                biglist.remove(src) 
            except IndexError:
                raise IndexError, "could not return item " + str(filecount) + " from list " + str(biglist)
        continue
               
           
       

if __name__ == '__main__':
    BreakUp(".")

Name: Anonymous 2010-01-19 21:29

>>31
You know a lot about PHP. Are you ashamed? Do you feel dirty?

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List