Tag Archives: linux

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])