Philip Burness wrote:
Could anybody provide me with a script that removes or replaces non compatible characters from file / directory names so that such files can be stored on a vfat filesystem?
<code> #! /usr/bin/env python # import os, sys, re def main(): try: dir = sys.argv[1] except IndexError: dir = raw_input("Search in which directory? ") os.chdir(dir) for filename in os.listdir(dir): if re.search(r'[/?<>\:*|"]',filename): print "Found file with illegal characters: %s\n" % filename newname = re.sub(r'[/?<>\:*|"]','_',filename) os.rename(filename, newname) print "Renamed file to: %s\n\n" % newname return if __name__ == '__main__': main() </code> -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org