{"id":27019243,"url":"https://github.com/jameslavin/mediatype_directory","last_synced_at":"2025-04-04T17:19:57.738Z","repository":{"id":4448998,"uuid":"5587470","full_name":"JamesLavin/mediatype_directory","owner":"JamesLavin","description":"mediatype_directory lets Linux/Mac users create a directory of (soft or hard) links to all files of a specified media type (or types) in a directory tree","archived":false,"fork":false,"pushed_at":"2012-09-11T17:53:53.000Z","size":164,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-04T15:18:49.672Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/JamesLavin.png","metadata":{"files":{"readme":"README.markdown","changelog":null,"contributing":null,"funding":null,"license":"license.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2012-08-28T14:55:21.000Z","updated_at":"2014-04-09T03:49:04.000Z","dependencies_parsed_at":"2022-08-21T00:20:17.023Z","dependency_job_id":null,"html_url":"https://github.com/JamesLavin/mediatype_directory","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JamesLavin%2Fmediatype_directory","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JamesLavin%2Fmediatype_directory/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JamesLavin%2Fmediatype_directory/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JamesLavin%2Fmediatype_directory/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/JamesLavin","download_url":"https://codeload.github.com/JamesLavin/mediatype_directory/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247217203,"owners_count":20903009,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-04-04T17:19:57.169Z","updated_at":"2025-04-04T17:19:57.730Z","avatar_url":"https://github.com/JamesLavin.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# MediatypeDirectory\n\n## DESCRIPTION\n\nMediatypeDirectory lets Linux/Mac users create a directory of (soft or hard) links to all files of a specified media type (or types) in a directory tree.\n\n## WHY?\n\nI store content (text files, PDFs, HTML pages, office suite files, audio files, video files, etc.) mixed together in directory trees organized by subject. For example, the directory ~/Tech/Ruby/TESTING/RSpec may hold videos, HTML files, PDFs, podcasts, etc. all related to RSpec testing in Ruby.\n\nBut when I'm programming, I often want to quickly grab a PDF reference document without searching through the directory tree. I want links to PDF files on Jasmine, RSpec, Rails, Ruby, Coffeescript, Underscore, JQuery, Javascript, Backbone, etc. all in one directory.\n\nAnd when I have free time to watch videos, I'd like to quickly see the list of all available programming video files.\n\n## REQUIREMENTS\n\nI've run this only on Linux. It likely works on OS X. It probably won't work on Windows.\n\n## BASIC USAGE\n\nCreate a new MediatypeDirectory object, passing in all your configuration options (or setting them on the object via setters). Then tell the new object to .create_directory:\n\n    require 'mediatype_directory'\n\n    config = {}\n    config[:what]       = '.pdf'    # OR an array like ['.htm','.html','.shtml'] OR or a special string, 'audio' or 'video'\n    config[:from]       = '~/path/to/top-level-dir/where/your/files/are'\n    config[:to]         = '~/path/to/dir/where/you/want/to/create/links'\n    config[:linktype]   = 'hard'    # default: 'soft'\n    config[:test_mode]  = true      # (or 'true', default: false)   In test_mode, no directories or files are actually created and no old links are removed\n    config[:remove_old_links]  = true   # (or 'true', default: false)  If true, all existing links in the link directory are deleted before creating new links\n\n    MediatypeDirectory.new(config).create_directory\n\nconfig[:what] has an alias, config[:extensions]. You can also call \"md.extensions = \" or \"md.what = \"\n\nconfig[:from] has aliases config[:source] \u0026 config[:directory_tree]. You can also call \"md.source =\", \"md.from = \" or \"md.directory_tree =\"\n\nconfig[:to] has aliases config[:target] \u0026 config[:mediatype_dirname]. You can also call \"md.target =\", \"md.to = \" or \"md.mediatype_dirname =\"\n\nIt's safe to re-run this program as many times as you want. If a link already exists, it will be skipped (unless you set :remove_old_links = true). But if a new file is found that matches the criteria, a new link will be added.\n\nIf the original content of a hard link changes, the hard link will continue referring to the original version. You can delete the hard link (which should remove the old version from your system) and regenerate a new hardlink, which should point to the new version.\n\n## DELETING A FILE WITH MULTIPLE LINKS\n\nAfter you create link directories, deleting files becomes a hassle because you must track down ALL file references. So we make this a bit easier.\n\nTo delete all links to a filename under a directory_tree:\n\n    require 'mediatype_directory'\n\n    MediatypeDirectory.delete_all 'file_I_want_to_delete.mp4', '~/path/to/top/of/directory_tree'\n\nTo see the files that would be deleted without deleting any (i.e., test mode), change the above to:\n\n    MediatypeDirectory.delete_all 'file_I_want_to_delete.mp4', '~/path/to/top/of/directory_tree', true\n\n(We will also provide this as a command-line option.)\n\n## EXAMPLE\n\n    require 'mediatype_directory'\n\n    md = MediatypeDirectory.new({\n          what: [\".flv\",\".mov\",\".mpg\",'.mp4'],        # List of file extensions for which you wish to generate links\n          from: '/home/jimmy/Tech/Ruby',              # Where to look for existing files\n          to: '~/Tech/Docs2/Videos',                  # Where to store links to existing files\n          linktype: 'hard',                           # Create hard links, not soft links (a.k.a. symbolic links)\n          test_mode: true                             # Show what would happen without actually creating directories or files\n        })\n\n    md.create_directory\n\n## COMING ATTRACTIONS (I HOPE)\n\n* More special strings, like 'photos'\n\n* Easy way to create combinations of :what and :from. For example, you might want to create ['~/Tech/Docs/PDFs', '~/Tech/Docs/Audio', '~/Tech/Docs/Video'] for each of five directory trees, ['~/Tech/Javascript', '~/Tech/Python', '~/Tech/PostgreSQL', '~/Tech/Ruby', '~/Tech/HTML5']\n\n* An option to update hardlinks if and only if the original file has changed\n\n## LEGAL DISCLAIMER\n\nPlease use at your own risk. I guarantee nothing about this program.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjameslavin%2Fmediatype_directory","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjameslavin%2Fmediatype_directory","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjameslavin%2Fmediatype_directory/lists"}