Removing punctuation from file names
Posted: 18 Oct 2014, 22:14
I like clean file names, just characters aplha-numnerics, period and underscore i.e. A-Z, a-z, 0-9, ., and _. I make an exception for spaces so Kodi scrapers will work. Currently my script uses this line:
Looking at the documentation I'm guessing there is no simple function to do this so I will need multiple replace function? If I use the replace function I'm not sure how to specify apostrophes, ampersands, slash and backslashes, ', &, / and \. How do other people keep their file names clean?
I am running version 4.5 on a CentOS server.
Code: Select all
def episodeFormat = '''/mnt/dst/TV/{n.ascii().replace(':', '')} ({y})/Season{s}/{n.ascii().upperInitial().space('.').replace(':', '')}.{s00e00}.{t.ascii().space('_').replace(':', '')}'''
I am running version 4.5 on a CentOS server.