Making this dot file manager script smarter