{ "info": { "author": "Thomas Lotze", "author_email": "thomas@thomas-lotze.de", "bugtrack_url": null, "classifiers": [ "Development Status :: 3 - Alpha", "Environment :: Console", "Intended Audience :: End Users/Desktop", "License :: OSI Approved :: Zope Public License", "Natural Language :: English", "Operating System :: POSIX" ], "description": "=====================\r\nOverview of tl.rename\r\n=====================\r\n\r\ntl.rename provides an implementation of the ``rename`` program some form of\r\nwhich is included with many POSIX operating systems. While those tools usually\r\ndo only substring or regular expression replacement, planned file name\r\ntransformations in tl.rename include:\r\n\r\n- substring replacement as in Gentoo's rename implementation, for example\r\n- regular expression replacement as seen in Debian's rename implementation\r\n- reading the new names from a file or standard input\r\n- various case transformations\r\n- additional regex replacements inserting formatted counters\r\n- interactive renaming using readline, if available\r\n- interactive renaming using an external text editor\r\n\r\nVersion 0.1 implements reading names from a file or standard input, case\r\ntransformations, simple substring replacement and interactive renaming using\r\nreadline.\r\n\r\nThe tl.rename package is readily usable as a library but also installs an\r\nexecutable script that exercises its functionality.\r\n\r\n\r\nUsage\r\n=====\r\n\r\n``rename [options] [file paths]``\r\n\r\nFile paths may contain directory paths and be either absolute or relative to\r\nthe current working directory. The specified files do not need to exist when\r\n``rename`` is called but will cause it to fail if they do not exist when the\r\nactual renaming is being done.\r\n\r\nOptions\r\n-------\r\n\r\n-h, --help show this help message and exit\r\n-d, --debug debug mode, do not catch Python exceptions\r\n-D, --dry-run dry-run mode, do not touch the file system\r\n-s SLICE, --slice=SLICE\r\n transform only a slice of each name, value is\r\n LOWER:UPPER, both bounds are optional\r\n-n NAMES_FILE, --names-file=NAMES_FILE\r\n read new names from file where - denotes standard input\r\n-c CASE, --case=CASE case-transform names, possible values are upper, lower,\r\n sentence\r\n-r FROM_TO, --replace=FROM_TO\r\n where FROM_TO is two distinct arguments (-r FROM TO);\r\n globally replace first option argument with second,\r\n may be given multiple times\r\n-i, --interactive edit names interactively (assumed if no transformation\r\n is explicitly specified)\r\n\r\n\r\nHow it works\r\n============\r\n\r\ntl.rename runs one or more string transformations on a sequence of file names\r\ngiven as command arguments, then renames the files accordingly.\r\n\r\nTransforming file names\r\n-----------------------\r\n\r\nWhich transformations to apply is determined by command line options. If\r\nmultiple transformations are selected, they will be run in the following\r\norder:\r\n\r\n#. Read names from file (``--names-file``)\r\n Read new file names from a file or standard input, one name per line.\r\n\r\n#. Case transformation (``--case``)\r\n Perform a case transformation on the file names:\r\n * Turn the names into all upper case (``upper``).\r\n * Turn the names into all lower case (``lower``).\r\n * Apply a style of mixed case, basically capitalizing the first word\r\n of a phrase (``sentence``). See the doctest examples for sentence\r\n case for the complete rules.\r\n\r\n#. Replace substrings (``--replace``)\r\n Replace substrings of the file names where match patterns and replacements\r\n are given literally as two arguments. Any number of replacements can be\r\n made in one go.\r\n\r\n#. Interactive replacement (``--interactive``)\r\n Let the user edit each file name in turn using the readline library if\r\n available. This provides comfortable line editing including a history.\r\n\r\nThe list of file names must fulfill the following conditions:\r\n\r\n- Each old and new name is non-empty and contains no null characters.\r\n\r\n- The number of names remains the same during each transformation.\r\n\r\n- Names must be unique before and after each transformation. Trailing path\r\n separators don't make a difference.\r\n\r\nRenaming files\r\n--------------\r\n\r\nOnce all transformations have been performed on the file names, those items\r\nwhose names have actually changed will be renamed in the file system (except\r\nif dry-run mode is active). Renaming is subject to the following rules:\r\n\r\n- Files and directories to be renamed must exist at this point.\r\n\r\n- If a file name contains subdirectory path elements and one of those has\r\n changed, the item will be moved to the new directory.\r\n\r\n- When moving items between directories, directory hierarchies will be created\r\n as needed and emptied directories are removed. Empty directories themselves\r\n can be moved.\r\n\r\n- Renaming a file to the name of another existing file overwrites that file.\r\n\r\n- Renaming a directory to the name of an existing empty directory overwrites\r\n that directory.\r\n\r\n- Directories cannot be renamed to existing populated directories or\r\n non-directories, nor can non-directories be renamed to existing directories.\r\n\r\n- Renaming an item to the name of another item that is renamed in the same run\r\n does not overwrite that item. In particular, it is possible to interchange\r\n the names of two items immediately.\r\n\r\n- Symbolic links are never followed.\r\n\r\nSlicing\r\n-------\r\n\r\nIt is possible to restrict transformations to a specified portion of each file\r\nname. As an example, this can be useful when applying sentence case to\r\nprefixed file names if the prefix should not count as the beginning of a\r\nsentence.\r\n\r\nWhich portion (or slice) of each file name to subject to transformations is\r\ndetermined by a specification given as the value of the ``--slice`` option.\r\nThe syntax of this value is that of Python's simple slices: two integer\r\nnumbers separated by a colon. The numbers denote the start and stop index of\r\nthe slice where counting starts from 0. The stop index is the index of the\r\nfirst character after the slice. Both start and stop index may be omitted (but\r\nthe colon may not); they default to the beginning and the end of the name (0\r\nand a very big number), respectively. Negative indexes are understood to count\r\nfrom the end of the name.\r\n\r\nLet's give some examples, applied to the file name\r\n\"05 - An interesting song.ogg\" (28 characters):\r\n\r\n============= ============================\r\nSpecification Slice\r\n============= ============================\r\n\\: 05 - An interesting song.ogg\r\n5:100 An interesting song.ogg\r\n:-4 05 - An interesting song\r\n5:-4 An interesting song\r\n5:24 An interesting song\r\n============= ============================\r\n\r\n\r\n.. Local Variables:\r\n.. mode: rst\r\n.. End:\r\n\r\n\r\n===============\r\nAbout tl.rename\r\n===============\r\n\r\n:Author:\r\n Thomas Lotze (thomas@thomas-lotze.de, http://thomas-lotze.de/)\r\n\r\n:Online documentation:\r\n http://packages.python.org/tl.rename/\r\n\r\n:PyPI page:\r\n http://pypi.python.org/pypi/tl.rename/\r\n\r\n:Issue tracker:\r\n https://bitbucket.org/tlotze/tl.rename/issues/\r\n\r\n:Source code:\r\n https://bitbucket.org/tlotze/tl.rename/\r\n\r\n:Current change log:\r\n https://bitbucket.org/tlotze/tl.rename/raw/tip/CHANGES.txt\r\n\r\n\r\n\r\n.. Local Variables:\r\n.. mode: rst\r\n.. End:", "description_content_type": null, "docs_url": "https://pythonhosted.org/tl.rename/", "download_url": "UNKNOWN", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "http://packages.python.org/tl.rename/", "keywords": "rename files", "license": "ZPL 2.1", "maintainer": "", "maintainer_email": "", "name": "tl.rename", "package_url": "https://pypi.org/project/tl.rename/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/tl.rename/", "project_urls": { "Download": "UNKNOWN", "Homepage": "http://packages.python.org/tl.rename/" }, "release_url": "https://pypi.org/project/tl.rename/0.1.2/", "requires_dist": null, "requires_python": null, "summary": "A rename implementation that does more than substring replacement.", "version": "0.1.2" }, "last_serial": 800760, "releases": { "0.1": [ { "comment_text": "", "digests": { "md5": "7b395f1c752b3368b507a1ff4a9d17cf", "sha256": "0c5599c8eae368295860119acce66a894df4fb95953239e3b6d5d89b0f8ca2ad" }, "downloads": -1, "filename": "tl.rename-0.1.tar.gz", "has_sig": true, "md5_digest": "7b395f1c752b3368b507a1ff4a9d17cf", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 10668, "upload_time": "2008-11-11T16:34:23", "url": "https://files.pythonhosted.org/packages/15/e5/609aa3d0eb551bcd7852eb63d6881890d71e2b4f7dc015114b13c315c7ca/tl.rename-0.1.tar.gz" } ], "0.1.1": [ { "comment_text": "", "digests": { "md5": "a85898d87a2eac75b73efb0ad1e607bc", "sha256": "b1646a7e4757164ffb3f075697842b7e14240d95aa62cc2fd9f46b496ed1c144" }, "downloads": -1, "filename": "tl.rename-0.1.1.tar.gz", "has_sig": true, "md5_digest": "a85898d87a2eac75b73efb0ad1e607bc", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 17240, "upload_time": "2008-12-17T09:43:25", "url": "https://files.pythonhosted.org/packages/f4/88/02196b2b9ea467319b0e71bda8a6fe7f0b6751af9eaed7b7b98cd79fd3bb/tl.rename-0.1.1.tar.gz" } ], "0.1.2": [ { "comment_text": "", "digests": { "md5": "679fee6a08e4970552180fbd7e84da67", "sha256": "0b70889063a2d592becdc1fd1f024f0b7c257bc4c8a53c7f961836f2eb724554" }, "downloads": -1, "filename": "tl.rename-0.1.2.tar.gz", "has_sig": true, "md5_digest": "679fee6a08e4970552180fbd7e84da67", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 19137, "upload_time": "2010-06-11T16:41:02", "url": "https://files.pythonhosted.org/packages/27/4e/0694626d88bbc085ec7b4a96a9fdaa6dce2f9b74b9c768de332762a5f6a8/tl.rename-0.1.2.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "679fee6a08e4970552180fbd7e84da67", "sha256": "0b70889063a2d592becdc1fd1f024f0b7c257bc4c8a53c7f961836f2eb724554" }, "downloads": -1, "filename": "tl.rename-0.1.2.tar.gz", "has_sig": true, "md5_digest": "679fee6a08e4970552180fbd7e84da67", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 19137, "upload_time": "2010-06-11T16:41:02", "url": "https://files.pythonhosted.org/packages/27/4e/0694626d88bbc085ec7b4a96a9fdaa6dce2f9b74b9c768de332762a5f6a8/tl.rename-0.1.2.tar.gz" } ] }