daily pastebin goal
20%
SHARE
TWEET

Untitled

a guest Mar 18th, 2018 61 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import os
  2.  
  3.  
  4. def remove_first_part_of_filenames(file_folder, size_str):
  5.  
  6.     for path, subdirs, files in os.walk(file_folder):
  7.  
  8.         for name in files:
  9.  
  10.             print("filename: %s" % name[len(size_str):])
  11.  
  12.             os.rename(os.path.join(path,name), os.path.join(path, name[len(size_str):]))
  13.  
  14.  
  15. file_folder = "C:\\Users\\gmasetti\\Dropbox\\ifremer\\renamed\\ascii"
  16. size_str = "survey_supporter_2016-260_"
  17.  
  18. remove_first_part_of_filenames(file_folder=file_folder, size_str=size_str)
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top