Created
January 1, 2015 18:43
-
-
Save noxan/f187f679708c078a5867 to your computer and use it in GitHub Desktop.
Removes date prefixes from all files in the current directory.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
import re | |
rootdir = os.path.dirname(os.path.realpath(__file__)) | |
REGEX = re.compile(r'([0-9]{8})-') | |
for root, subdirs, files in os.walk(rootdir): | |
for filename in files: | |
src = os.path.join(root, filename) | |
dst = os.path.join(root, re.sub(REGEX, "", filename)) | |
os.rename(src, dst) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Removes date prefixes from files in the current directory and of all sub-directories. If you checked this option in Adobe Lightroom on accident or just want to get rid of the date prefix (e.g.
20150101-IMG_00001.JPG
toIMG_00001.JPG
), then this script might be useful to you.