fullpath83replace


Namefullpath83replace JSON
Version 0.12 PyPI version JSON
download
home_pagehttps://github.com/hansalemaos/fullpath83replace
SummaryConverts long Windows file paths to their short 8.3 format in a string where applicable
upload_time2023-10-09 04:29:21
maintainer
docs_urlNone
authorJohannes Fischer
requires_python
licenseMIT
keywords convert path windows 83
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            
# Converts long Windows file paths to their short 8.3 format in a string where applicable.

## Tested against Windows / Python 3.11 / Anaconda

## pip install fullpath83replace

```python
absolut_wpath_to_83(
    string, valid_string_ends=("<", ">", ":", '"', "|", "?", "*", "\n", "\r", " ")
):
    r"""

This function takes a string containing file paths and attempts to convert long
Windows file paths to their short 8.3 format where applicable. It identifies file
paths in the input string, checks if they exist, and if they do, replaces them
with their short 8.3 format versions.

Parameters:
- string (str): The input string containing file paths.
- valid_string_ends (tuple): A tuple of valid string endings 'c:\some long path' will not be converted if "'" is not in valid_string_ends

Returns:
- str: The input string with long file paths replaced by their short 8.3 format
  versions, while preserving valid string endings.

Example Usage:
	from fullpath83replace import absolut_wpath_to_83
	string1 = r'"C:\Users\hansc\Downloads\scrapingthreading.mp4" c:\babaexistsbutnottherest  "C:\Users\hansc\Downloads\Roger LeRoy Miller, Daniel K. Benjamin, Douglass C. North - The Economics of Public Issues-Pearson College Div (2017).pdf" c:\baba c:\Windows'
	str1 = absolut_wpath_to_83(
		string1, valid_string_ends=("<", ">", ":", '"', "|", "?", "*", "\n", "\r", " ")
	)


	string2 = r'C:\Users\hansc\Downloads\scrapingthreading.mp4 c:\babaexists butnot therest  C:\Users\hansc\Downloads\Roger LeRoy Miller, Daniel K. Benjamin, Douglass C. North - The Economics of Public Issues-Pearson College Div (2017).pdf c:\baba "c:\Windows" '
	str2 = absolut_wpath_to_83(
		string2, valid_string_ends=("<", ">", ":", '"', "|", "?", "*", "\n", "\r", " ")
	)

	string3 = r''' C:\Users\hansc\Downloads\scrapingthreading.mp4 c:\babaxxxas\asfasdxx\bi  'C:\Users\hansc\Downloads\Roger LeRoy Miller, Daniel K. Benjamin, Douglass C. North - The Economics of Public Issues-Pearson College Div (2017).pdf' xxxxxxxxxxxxxxxxxx "c:\baba" c:\Windows'''
	str3 = absolut_wpath_to_83(
		string3, valid_string_ends=("<", ">", ":", '"', "|", "?", "*", "\n", "\r", " ", "'")
	)


	print(str1)
	print(string1)
	# "C:\Users\hansc\DOWNLO~1\SCRAPI~1.MP4" c:\babaexistsbutnottherest  "C:\Users\hansc\DOWNLO~1\ROGERL~1.PDF" c:\baba c:\Windows
	# "C:\Users\hansc\Downloads\scrapingthreading.mp4" c:\babaexistsbutnottherest  "C:\Users\hansc\Downloads\Roger LeRoy Miller, Daniel K. Benjamin, Douglass C. North - The Economics of Public Issues-Pearson College Div (2017).pdf" c:\baba c:\Windows
	print(str2)
	print(string2)
	# C:\Users\hansc\DOWNLO~1\SCRAPI~1.MP4 c:\babaexists butnot therest  C:\Users\hansc\DOWNLO~1\ROGERL~1.PDF c:\baba "c:\Windows
	# C:\Users\hansc\Downloads\scrapingthreading.mp4 c:\babaexists butnot therest  C:\Users\hansc\Downloads\Roger LeRoy Miller, Daniel K. Benjamin, Douglass C. North - The Economics of Public Issues-Pearson College Div (2017).pdf c:\baba "c:\Windows"
	print(str3)
	print(string3)
	#  C:\Users\hansc\DOWNLO~1\SCRAPI~1.MP4 c:\babaxxxas\asfasdxx\bi  'C:\Users\hansc\DOWNLO~1\ROGERL~1.PDF' xxxxxxxxxxxxxxxxxx "c:\baba" c:\Windows
	#  C:\Users\hansc\Downloads\scrapingthreading.mp4 c:\babaxxxas\asfasdxx\bi  'C:\Users\hansc\Downloads\Roger LeRoy Miller, Daniel K. Benjamin, Douglass C. North - The Economics of Public Issues-Pearson College Div (2017).pdf' xxxxxxxxxxxxxxxxxx "c:\baba" c:\Windows

```

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/hansalemaos/fullpath83replace",
    "name": "fullpath83replace",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "",
    "keywords": "convert,path,windows,83",
    "author": "Johannes Fischer",
    "author_email": "aulasparticularesdealemaosp@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/55/70/2ca9185ae6e623b57a5f055812192623f20b017f25b2318c51cc9c54b373/fullpath83replace-0.12.tar.gz",
    "platform": null,
    "description": "\r\n# Converts long Windows file paths to their short 8.3 format in a string where applicable.\r\n\r\n## Tested against Windows / Python 3.11 / Anaconda\r\n\r\n## pip install fullpath83replace\r\n\r\n```python\r\nabsolut_wpath_to_83(\r\n    string, valid_string_ends=(\"<\", \">\", \":\", '\"', \"|\", \"?\", \"*\", \"\\n\", \"\\r\", \" \")\r\n):\r\n    r\"\"\"\r\n\r\nThis function takes a string containing file paths and attempts to convert long\r\nWindows file paths to their short 8.3 format where applicable. It identifies file\r\npaths in the input string, checks if they exist, and if they do, replaces them\r\nwith their short 8.3 format versions.\r\n\r\nParameters:\r\n- string (str): The input string containing file paths.\r\n- valid_string_ends (tuple): A tuple of valid string endings 'c:\\some long path' will not be converted if \"'\" is not in valid_string_ends\r\n\r\nReturns:\r\n- str: The input string with long file paths replaced by their short 8.3 format\r\n  versions, while preserving valid string endings.\r\n\r\nExample Usage:\r\n\tfrom fullpath83replace import absolut_wpath_to_83\r\n\tstring1 = r'\"C:\\Users\\hansc\\Downloads\\scrapingthreading.mp4\" c:\\babaexistsbutnottherest  \"C:\\Users\\hansc\\Downloads\\Roger LeRoy Miller, Daniel K. Benjamin, Douglass C. North - The Economics of Public Issues-Pearson College Div (2017).pdf\" c:\\baba c:\\Windows'\r\n\tstr1 = absolut_wpath_to_83(\r\n\t\tstring1, valid_string_ends=(\"<\", \">\", \":\", '\"', \"|\", \"?\", \"*\", \"\\n\", \"\\r\", \" \")\r\n\t)\r\n\r\n\r\n\tstring2 = r'C:\\Users\\hansc\\Downloads\\scrapingthreading.mp4 c:\\babaexists butnot therest  C:\\Users\\hansc\\Downloads\\Roger LeRoy Miller, Daniel K. Benjamin, Douglass C. North - The Economics of Public Issues-Pearson College Div (2017).pdf c:\\baba \"c:\\Windows\" '\r\n\tstr2 = absolut_wpath_to_83(\r\n\t\tstring2, valid_string_ends=(\"<\", \">\", \":\", '\"', \"|\", \"?\", \"*\", \"\\n\", \"\\r\", \" \")\r\n\t)\r\n\r\n\tstring3 = r''' C:\\Users\\hansc\\Downloads\\scrapingthreading.mp4 c:\\babaxxxas\\asfasdxx\\bi  'C:\\Users\\hansc\\Downloads\\Roger LeRoy Miller, Daniel K. Benjamin, Douglass C. North - The Economics of Public Issues-Pearson College Div (2017).pdf' xxxxxxxxxxxxxxxxxx \"c:\\baba\" c:\\Windows'''\r\n\tstr3 = absolut_wpath_to_83(\r\n\t\tstring3, valid_string_ends=(\"<\", \">\", \":\", '\"', \"|\", \"?\", \"*\", \"\\n\", \"\\r\", \" \", \"'\")\r\n\t)\r\n\r\n\r\n\tprint(str1)\r\n\tprint(string1)\r\n\t# \"C:\\Users\\hansc\\DOWNLO~1\\SCRAPI~1.MP4\" c:\\babaexistsbutnottherest  \"C:\\Users\\hansc\\DOWNLO~1\\ROGERL~1.PDF\" c:\\baba c:\\Windows\r\n\t# \"C:\\Users\\hansc\\Downloads\\scrapingthreading.mp4\" c:\\babaexistsbutnottherest  \"C:\\Users\\hansc\\Downloads\\Roger LeRoy Miller, Daniel K. Benjamin, Douglass C. North - The Economics of Public Issues-Pearson College Div (2017).pdf\" c:\\baba c:\\Windows\r\n\tprint(str2)\r\n\tprint(string2)\r\n\t# C:\\Users\\hansc\\DOWNLO~1\\SCRAPI~1.MP4 c:\\babaexists butnot therest  C:\\Users\\hansc\\DOWNLO~1\\ROGERL~1.PDF c:\\baba \"c:\\Windows\r\n\t# C:\\Users\\hansc\\Downloads\\scrapingthreading.mp4 c:\\babaexists butnot therest  C:\\Users\\hansc\\Downloads\\Roger LeRoy Miller, Daniel K. Benjamin, Douglass C. North - The Economics of Public Issues-Pearson College Div (2017).pdf c:\\baba \"c:\\Windows\"\r\n\tprint(str3)\r\n\tprint(string3)\r\n\t#  C:\\Users\\hansc\\DOWNLO~1\\SCRAPI~1.MP4 c:\\babaxxxas\\asfasdxx\\bi  'C:\\Users\\hansc\\DOWNLO~1\\ROGERL~1.PDF' xxxxxxxxxxxxxxxxxx \"c:\\baba\" c:\\Windows\r\n\t#  C:\\Users\\hansc\\Downloads\\scrapingthreading.mp4 c:\\babaxxxas\\asfasdxx\\bi  'C:\\Users\\hansc\\Downloads\\Roger LeRoy Miller, Daniel K. Benjamin, Douglass C. North - The Economics of Public Issues-Pearson College Div (2017).pdf' xxxxxxxxxxxxxxxxxx \"c:\\baba\" c:\\Windows\r\n\r\n```\r\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Converts long Windows file paths to their short 8.3 format in a string where applicable",
    "version": "0.12",
    "project_urls": {
        "Homepage": "https://github.com/hansalemaos/fullpath83replace"
    },
    "split_keywords": [
        "convert",
        "path",
        "windows",
        "83"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "a10473dc6c5a641f0f4c7afa1837962af130368075fed82ad4c3fc863801c7e9",
                "md5": "75f933e950cb98943933645007ac8e08",
                "sha256": "49ad6086e63c304a3df88703b3b07e5e3048865e6b12c4f43dabd95e185de9f8"
            },
            "downloads": -1,
            "filename": "fullpath83replace-0.12-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "75f933e950cb98943933645007ac8e08",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 6288,
            "upload_time": "2023-10-09T04:29:19",
            "upload_time_iso_8601": "2023-10-09T04:29:19.984904Z",
            "url": "https://files.pythonhosted.org/packages/a1/04/73dc6c5a641f0f4c7afa1837962af130368075fed82ad4c3fc863801c7e9/fullpath83replace-0.12-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "55702ca9185ae6e623b57a5f055812192623f20b017f25b2318c51cc9c54b373",
                "md5": "85663d3f57005d2f838b4597b05b9e58",
                "sha256": "6a8358efa268140182ffebab359c3bedc5773c3ee0e8738dec61390e5931a1a4"
            },
            "downloads": -1,
            "filename": "fullpath83replace-0.12.tar.gz",
            "has_sig": false,
            "md5_digest": "85663d3f57005d2f838b4597b05b9e58",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 4466,
            "upload_time": "2023-10-09T04:29:21",
            "upload_time_iso_8601": "2023-10-09T04:29:21.888880Z",
            "url": "https://files.pythonhosted.org/packages/55/70/2ca9185ae6e623b57a5f055812192623f20b017f25b2318c51cc9c54b373/fullpath83replace-0.12.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-10-09 04:29:21",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "hansalemaos",
    "github_project": "fullpath83replace",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "requirements": [],
    "lcname": "fullpath83replace"
}
        
Elapsed time: 0.12003s