Unhiding Subdirectories

Made a terrible mistake in easytag and this script was necessary. It will unhide all subfiles of a directory (at any subdirectory level) by simply renaming them to not start with ‘.’ (linux)

#!/usr/bin/python
import os, shutil, sys

def unhide_subfiles(directory):
    for dirpath, dirnames, filenames in os.walk(directory):
        for f in filenames:
            if f[0] == '.':

                fpath = os.path.join(dirpath, f)
                nfpath = os.path.join(dirpath, f[1:])
                shutil.move(fpath, nfpath)

if __name__=='__main__':
    if len(sys.argv) != 2:
        print('Pass directory such that all subfiles of directory should be unhidden')
        exit(1)

    unhide_subfiles(sys.argv[1])

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>