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
Post a Comment