Skip to content

Instantly share code, notes, and snippets.

@aks
Created March 16, 2018 17:11
Show Gist options
  • Select an option

  • Save aks/4683b66f047a15b96f761e205a7adfee to your computer and use it in GitHub Desktop.

Select an option

Save aks/4683b66f047a15b96f761e205a7adfee to your computer and use it in GitHub Desktop.
Little bash script around a one-liner that produces a tree listing of a directory
#!/bin/sh
# dtree DIR
#
ls -R $* | grep ':$' | sed -e 's/:$//' -e 's/[^-][^\/]*\//--/g' -e 's/^/ /' -e 's/-/|/'
exit
|-actioncable
|---app
|-----assets
|-------javascripts
|---------action_cable
|---bin
|---lib
|-----action_cable
|-------channel
|-------connection
|-------helpers
|-------server
|---------worker
|-------subscription_adapter
|-----rails
|-------generators
|---------channel
|-----------templates
|-------------application_cable
|-------------assets
|---test
|-----channel
|-----connection
|-----javascript
|-------src
|---------test_helpers
|---------unit
|-------vendor
|-----server
|-----stubs
|-----subscription_adapter
|-actionmailer
|---bin
|---lib
|-----action_mailer
|-----rails
|-------generators
|---------mailer
|-----------templates
|---test
|-----fixtures
|-------anonymous
|-------another.path
|---------base_mailer
|-------asset_host_mailer
|-------asset_mailer
|-------attachments
|-------auto_layout_mailer
|-------base_mailer
|-------base_test
|---------after_action_mailer
|---------before_action_mailer
|---------default_inline_attachment_mailer
|---------late_inline_attachment_mailer
|-------caching_mailer
|-------explicit_layout_mailer
|-------i18n_test_mailer
|-------layouts
|-------mail_delivery_test
|---------delivery_mailer
|-------nested_layout_mailer
|-------proc_mailer
|-------templates
|-------test_helper_mailer
|-------url_test_mailer
|-----mailers
|-actionpack
|---bin
|---lib
|-----abstract_controller
|-------caching
|-------railties
|-----action_controller
|-------api
|-------metal
|-------railties
|-----action_dispatch
|-------http
|-------journey
|---------gtg
|---------nfa
|---------nodes
|---------path
|---------router
|---------visualizer
|-------middleware
|---------session
|---------templates
|-----------rescues
|-----------routes
|-------request
|-------routing
|-------system_testing
|---------test_helpers
|-------testing
|---------assertions
|-----action_pack
|---test
|-----abstract
|-----assertions
|-----controller
|-------api
|-------controller_fixtures
|---------app
|-----------controllers
|-------------admin
|---------vendor
|-----------plugins
|-------------bad_plugin
|---------------lib
|-------metal
|-------mime
|-------new_base
|-------parameters
|-------request
|-----dispatch
|-------request
|-------routing
|-------session
|-------system_testing
|-----fixtures
|-------alternate_helpers
|-------bad_customers
|-------collection_cache
|-------customers
|-------filter_test
|---------implicit_actions
|-------functional_caching
|-------helpers
|---------fun
|-------helpers1_pack
|-------helpers2_pack
|-------helpers_typo
|---------admin
|-------implicit_render_test
|-------layouts
|-------localized
|-------multipart
|-------namespaced
|---------implicit_render_test
|-------old_content_type
|-------post_test
|---------layouts
|---------post
|---------super_post
|-------public
|---------bar
|---------foo
|---------gzip
|-------respond_to
|---------layouts
|-------session_autoload_test
|---------session_autoload_test
|-------star_star_mime
|-------test
|---------dot.directory
|---------hello
|-------公共
|---------bar
|---------foo
|---------gzip
|-----journey
|-------gtg
|-------nfa
|-------nodes
|-------path
|-------route
|---------definition
|-------router
|-----lib
|-------controller
|-----routing
|-----tmp
|-actionview
|---app
|-----assets
|-------javascripts
|---------rails-ujs
|-----------features
|-----------utils
|---bin
|---lib
|-----action_view
|-------helpers
|---------tags
|-------locale
|-------renderer
|---------partial_renderer
|-------tasks
|-------template
|---------handlers
|-----------erb
|-------testing
|---test
|-----actionpack
|-------abstract
|---------views
|-----------abstract_controller
|-------------testing
|---------------me3
|---------------me4
|-----------layouts
|-------------abstract_controller
|---------------testing
|-------controller
|-----activerecord
|-----fixtures
|-------actionpack
|---------bad_customers
|---------customers
|---------fun
|-----------games
|---------good_customers
|---------layout_tests
|-----------alt
|-------------layouts
|-----------layouts
|-------------controller_name_space
|-------------symlinked
|-----------views
|---------layouts
|---------quiz
|-----------questions
|---------test
|-----------_directory
|-----------dot.directory
|-----------hello
|-------comments
|-------custom_pattern
|---------html
|-------customers
|-------db_definitions
|-------developers
|-------digestor
|---------api
|-----------comments
|---------comments
|---------events
|---------level
|-----------below
|---------messages
|-----------actions
|-------fun
|---------games
|---------serious
|-----------games
|-------games
|-------good_customers
|-------helpers
|-------helpers_missing
|-------layout_tests
|---------alt
|-------layouts
|-------mascots
|-------override
|---------test
|-------override2
|---------layouts
|-----------test
|-------projects
|-------public
|---------elsewhere
|---------foo
|---------javascripts
|-----------subdir
|---------stylesheets
|-----------subdir
|-------replies
|-------respond_to
|-------test
|---------_directory
|---------dot.directory
|---------hello
|---------malformed
|-------topics
|-------translations
|---------templates
|-----lib
|-------controller
|-----template
|-------erb
|-------form_helper
|-------testing
|-----tmp
|-----ujs
|-------public
|---------test
|---------vendor
|-------views
|---------layouts
|---------tests
|-activejob
|---bin
|---lib
|-----active_job
|-------queue_adapters
|-----rails
|-------generators
|---------job
|-----------templates
|---test
|-----adapters
|-----cases
|-----integration
|-----jobs
|-----models
|-----support
|-------backburner
|-------delayed_job
|---------delayed
|-----------backend
|-----------serialization
|-------integration
|---------adapters
|-------que
|-------queue_classic
|-------sneakers
|-activemodel
|---bin
|---lib
|-----active_model
|-------attribute
|-------attribute_set
|-------locale
|-------serializers
|-------type
|---------helpers
|-------validations
|---test
|-----cases
|-------serializers
|-------type
|-------validations
|-----models
|-----validators
|-------namespace
|-activerecord
|---bin
|---examples
|---lib
|-----active_record
|-------associations
|---------builder
|---------join_dependency
|---------preloader
|-------attribute_methods
|-------coders
|-------connection_adapters
|---------abstract
|---------mysql
|---------postgresql
|-----------oid
|---------sqlite3
|-------fixture_set
|-------locale
|-------locking
|-------migration
|-------railties
|-------relation
|---------batches
|---------predicate_builder
|-------scoping
|-------tasks
|-------type
|---------internal
|-------type_caster
|-------validations
|-----rails
|-------generators
|---------active_record
|-----------application_record
|-------------templates
|-----------migration
|-------------templates
|-----------model
|-------------templates
|---test
|-----active_record
|-------connection_adapters
|-----assets
|-----cases
|-------adapters
|---------mysql2
|---------postgresql
|---------sqlite3
|-------associations
|-------attribute_methods
|-------coders
|-------connection_adapters
|-------connection_specification
|-------fixture_set
|-------migration
|-------relation
|-------scoping
|-------tasks
|-------type
|-------validations
|-----fixtures
|-------admin
|-------all
|---------namespaced
|-------categories
|---------subsubdir
|-------naked
|---------yml
|-------reserved_words
|-------to_be_linked
|-----migrations
|-------10_urban
|-------decimal
|-------empty
|-------magic
|-------missing
|-------rename
|-------to_copy
|-------to_copy2
|-------to_copy_with_name_collision
|-------to_copy_with_timestamps
|-------to_copy_with_timestamps2
|-------valid
|-------valid_with_subdirectories
|---------sub
|---------sub1
|-------valid_with_timestamps
|-------version_check
|-----models
|-------admin
|-------autoloadable
|-------publisher
|-----schema
|-----support
|-------yaml_compatibility_fixtures
|-activestorage
|---app
|-----assets
|-------javascripts
|-----controllers
|-------active_storage
|-------concerns
|---------active_storage
|-----javascript
|-------activestorage
|-----jobs
|-------active_storage
|-----models
|-------active_storage
|---------blob
|---------filename
|---bin
|---config
|---db
|-----migrate
|---lib
|-----active_storage
|-------analyzer
|-------attached
|-------previewer
|-------service
|-----tasks
|---test
|-----analyzer
|-----controllers
|-----database
|-----dummy
|-------app
|---------assets
|-----------config
|-----------images
|-----------javascripts
|-----------stylesheets
|---------controllers
|-----------concerns
|---------helpers
|---------jobs
|---------models
|-----------concerns
|---------views
|-----------layouts
|-------bin
|-------config
|---------environments
|---------initializers
|-------lib
|---------assets
|-------log
|-------public
|-----fixtures
|-------files
|-----models
|-------filename
|-----previewer
|-----service
|-----template
|-activesupport
|---bin
|---lib
|-----active_support
|-------cache
|---------strategy
|-------concurrency
|-------core_ext
|---------array
|---------big_decimal
|---------class
|---------date
|---------date_and_time
|---------date_time
|---------digest
|---------file
|---------hash
|---------integer
|---------kernel
|---------module
|---------numeric
|---------object
|---------range
|---------string
|---------time
|-------dependencies
|-------deprecation
|-------duration
|-------inflector
|-------json
|-------locale
|-------log_subscriber
|-------messages
|-------multibyte
|-------notifications
|-------number_helper
|-------testing
|-------values
|-------xml_mini
|---test
|-----autoloading_fixtures
|-------a
|---------c
|-----------em
|-------class_folder
|-------html
|-------load_path
|-------module_folder
|-------module_with_custom_const_missing
|---------a
|-------prepend
|-----cache
|-------behaviors
|-------stores
|-----concurrency
|-----core_ext
|-------array
|-------class
|-------digest
|-------hash
|-------kernel
|-------module
|-------object
|-----dependencies
|-----deprecation
|-----file_fixtures
|-----fixtures
|-------autoload
|-------xml
|-----json
|-----messages
|-----metadata
|-----notifications
|-----testing
|-----xml_mini
|-ci
|-guides
|---assets
|-----images
|-------getting_started
|-------i18n
|-------icons
|---------callouts
|-----javascripts
|-----stylesheets
|-------syntaxhighlighter
|---bug_report_templates
|---rails_guides
|-----markdown
|---source
|-----kindle
|-railties
|---bin
|---exe
|---lib
|-----minitest
|-----rails
|-------api
|-------application
|-------command
|---------helpers
|-------commands
|---------application
|---------console
|---------credentials
|---------dbconsole
|---------destroy
|---------encrypted
|---------generate
|---------help
|---------new
|---------plugin
|---------rake
|---------runner
|---------secrets
|---------server
|---------test
|---------version
|-------console
|-------engine
|-------generators
|---------actions
|---------css
|-----------assets
|-------------templates
|-----------scaffold
|---------erb
|-----------controller
|-------------templates
|-----------mailer
|-------------templates
|-----------scaffold
|-------------templates
|---------js
|-----------assets
|-------------templates
|---------rails
|-----------app
|-------------templates
|---------------app
|-----------------assets
|-------------------config
|-------------------javascripts
|-------------------stylesheets
|-----------------channels
|-------------------application_cable
|-----------------controllers
|-----------------helpers
|-----------------jobs
|-----------------mailers
|-----------------models
|-----------------views
|-------------------layouts
|---------------bin
|---------------config
|-----------------databases
|-----------------environments
|-----------------initializers
|-----------------locales
|---------------db
|---------------public
|---------------test
|-----------application_record
|-----------assets
|-------------templates
|-----------controller
|-------------templates
|-----------credentials
|-----------encrypted_file
|-----------encryption_key_file
|-----------generator
|-------------templates
|---------------templates
|-----------helper
|-------------templates
|-----------integration_test
|-----------master_key
|-----------migration
|-----------model
|-----------plugin
|-------------templates
|---------------app
|-----------------controllers
|-------------------%namespaced_name%
|-----------------helpers
|-------------------%namespaced_name%
|-----------------jobs
|-------------------%namespaced_name%
|-----------------mailers
|-------------------%namespaced_name%
|-----------------models
|-------------------%namespaced_name%
|-----------------views
|-------------------layouts
|---------------------%namespaced_name%
|---------------bin
|---------------config
|---------------lib
|-----------------%namespaced_name%
|-----------------tasks
|---------------rails
|---------------test
|-----------------integration
|-----------resource
|-----------resource_route
|-----------scaffold
|-------------templates
|-----------scaffold_controller
|-------------templates
|-----------system_test
|-----------task
|-------------templates
|---------test_unit
|-----------controller
|-------------templates
|-----------generator
|-------------templates
|-----------helper
|-----------integration
|-------------templates
|-----------job
|-------------templates
|-----------mailer
|-------------templates
|-----------model
|-------------templates
|-----------plugin
|-------------templates
|-----------scaffold
|-------------templates
|-----------system
|-------------templates
|---------testing
|-------plugin
|-------rack
|-------railtie
|-------tasks
|-------templates
|---------layouts
|---------rails
|-----------info
|-----------mailers
|-----------welcome
|-------test_unit
|---test
|-----application
|-------configuration
|-------initializers
|-------middleware
|-------rack
|-------rake
|-----command
|-----commands
|-----configuration
|-----engine
|-----fixtures
|-------lib
|---------generators
|-----------active_record
|-----------usage_template
|---------rails
|-----------generators
|-------------foobar
|-----generators
|-----isolation
|-----railties
|-----test_unit
|-tasks
|-tools
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment