3These are scripts for manipulating files and folders in my local filesystem.
5## The individual scripts
9# This adds the root of the repo to the PATH, which has cog_helpers.py
10from os.path import abspath, dirname
13sys.path.append(abspath(dirname(dirname("."))))
23 counts all the entries in subfolders under the working directory, and prints them in a table
35 "usage": "deepestdir [ROOT]",
36 "description": "prints the directory which is the deepest child of the given directory"
41 flattens a directory structure.
42 When you run it in a folder, it moves any files in subfolders into the top-level folders, then deletes the now-empty folder.
46 "variants": ["hide [PATH]", "unhide [PATH]"],
47 "description": "alias for
`chflags hidden PATH` and <code>chflags nohidden PATH</code>."
50 "name": "latest_download",
51 "description": "prints the path to the newest file in my Downloads folder"
54 "usage": "reveal PATH",
55 "description": "reveal the file/folder in the macOS Finder; alias for <code>open -R</code>"
60 gets the total size of all the files/folders under the working directory, and prints them in a table
67 7.58M ~/repos/scripts</code></pre></p>
72cog_helpers.create_description_table(folder_name=folder_name, scripts=scripts)
77 <a href="https://github.com/alexwlchan/scripts/blob/main/fs/cdir.py">
82 counts all the entries in subfolders under the working directory, and prints them in a table
94 <a href="https://github.com/alexwlchan/scripts/blob/main/fs/deepestdir">
95 <code>deepestdir [ROOT]</code>
99 prints the directory which is the deepest child of the given directory
103 <a href="https://github.com/alexwlchan/scripts/blob/main/fs/flatten">
108 flattens a directory structure.
109 When you run it in a folder, it moves any files in subfolders into the top-level folders, then deletes the now-empty folder.
113 <a href="https://github.com/alexwlchan/scripts/blob/main/fs/hide">
114 <code>hide [PATH]</code>
117 <a href="https://github.com/alexwlchan/scripts/blob/main/fs/unhide">
118 <code>unhide [PATH]</code>
122 alias for
`chflags hidden PATH` and <code>chflags nohidden PATH</code>.
126 <a href="https://github.com/alexwlchan/scripts/blob/main/fs/latest_download">
127 <code>latest_download</code>
131 prints the path to the newest file in my Downloads folder
135 <a href="https://github.com/alexwlchan/scripts/blob/main/fs/reveal">
136 <code>reveal PATH</code>
140 reveal the file/folder in the macOS Finder; alias for <code>open -R</code>
144 <a href="https://github.com/alexwlchan/scripts/blob/main/fs/sizes">
149 gets the total size of all the files/folders under the working directory, and prints them in a table
150 <p><pre><code>$ sizes
156 7.58M ~/repos/scripts</code></pre></p>
159<!-- [[[end]]] (sum: P2FdK3NhVa) -->