python - Losing images when running program -


i'm running os.rename program on thousands of images rename them , deletes hundreds of them. luckily made backups, there way stop this??

my code looks this:

    #!/usr/bin/python     import os, shutil     _src = ("/path/to/directory")        i,filename in enumerate(os.listdir(_src)):              newname = ('truck-' + str(i).zfill(3))             os.rename(os.path.join(_src, filename), os.path.join(_src,newname))               print('renaming "%s" "%s"...' % (filename, newname)) 

the thing can think of doing somehow keeping file loaded don't know start on that.


Comments

Popular posts from this blog

node.js - Node js - Trying to send POST request, but it is not loading javascript content -

javascript - Replicate keyboard event with html button -

javascript - Web audio api 5.1 surround example not working in firefox -