AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |
Back to Blog
Sample to do list4/13/2023 ![]() Generator script with recursive traversal ignore-case = make the -I and -P options case insensitive P "*.html|*.mp4|*.vtt" = glob by extensions to include Some useful flags you might want to add: -I ".git" = glob patterns to Ignore NOTE: -I "index.html" is used to exclude the index.html file itself from the generated index. Recursively create index.html files in subdirectoriesĬombined with gnu find you can recursively create index files in a subtree e.g. Tree -H '.' -L 1 -noreport -charset utf-8 | sed -e '//,+7d' > index.htmlįor all supported options see tree -help or man tree in a shell. Tree does not expose a flag to disable the credits in the HTML footer, but you can cut it out by piping through sed: # delete 7 lines starting with the line matching timefmt '%d-%b-%Y %H:%M' set the date format (see man strftime in your terminal for details). L 1 limits the listing to the current directory only H '.' the base href, can be relative e.g. *.zip and *.gz files: tree -H '.' -L 1 -noreport -charset utf-8 -P "*.zip|*.gz" -o index.html Only include specific file types that match a glob pattern, e.g. Generate an HTML directory index one level deep: tree -H '.' -L 1 -noreport -dirsfirst -T 'Downloads' -s -D -charset utf-8 -o index.html tree can generate plain text, XML, JSON or HTML output. Tree is a minimalistic utility that is available on most unix-like systems (ubuntu/debian: sudo apt install tree, mac: brew install tree, windows: zip). In such cases you might still want to have a statically generated index.html file for specific folders. Or, for example, you might want to only include certain file types in the index. ![]() There are enough valid reasons to explicitly disable automatic directory indexes in apache or other web servers.
0 Comments
Read More
Leave a Reply. |