mirror of
https://github.com/ansible/ansible.git
synced 2026-08-03 08:03:05 +02:00
Update win_dirname and win_basename docs (#84587)
* Updated docs and examples for win_dirname and win_basename for UNC path Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
This commit is contained in:
@@ -5,6 +5,7 @@ DOCUMENTATION:
|
||||
short_description: Get a Windows path's base name
|
||||
description:
|
||||
- Returns the last name component of a Windows path, what is left in the string that is not 'win_dirname'.
|
||||
- While specifying an UNC (Universal Naming Convention) path, please make sure the path conforms to the UNC path syntax.
|
||||
options:
|
||||
_input:
|
||||
description: A Windows path.
|
||||
@@ -16,7 +17,11 @@ DOCUMENTATION:
|
||||
EXAMPLES: |
|
||||
|
||||
# To get the last name of a file Windows path, like 'foo.txt' out of 'C:\Users\asdf\foo.txt'
|
||||
{{ mypath | win_basename }}
|
||||
filename: "{{ mypath | win_basename }}"
|
||||
|
||||
# Get basename from the UNC path in the form of '\\<SERVER_NAME>\<SHARE_NAME>\<FILENAME.FILE_EXTENSION>'
|
||||
# like '\\server1\test\foo.txt' returns 'foo.txt'
|
||||
filename: "{{ mypath | win_basename }}"
|
||||
|
||||
RETURN:
|
||||
_value:
|
||||
|
||||
@@ -5,6 +5,7 @@ DOCUMENTATION:
|
||||
short_description: Get a Windows path's directory
|
||||
description:
|
||||
- Returns the directory component of a Windows path, what is left in the string that is not 'win_basename'.
|
||||
- While specifying an UNC (Universal Naming Convention) path, please make sure the path conforms to the UNC path syntax.
|
||||
options:
|
||||
_input:
|
||||
description: A Windows path.
|
||||
@@ -18,6 +19,10 @@ EXAMPLES: |
|
||||
# To get the last name of a file Windows path, like 'C:\users\asdf' out of 'C:\Users\asdf\foo.txt'
|
||||
{{ mypath | win_dirname }}
|
||||
|
||||
# Get dirname from the UNC path in the form of '\\<SERVER_NAME>\<SHARE_NAME>\<FILENAME.FILE_EXTENSION>'
|
||||
# like '\\server1\test\foo.txt' returns '\\\\server1\\test\\'
|
||||
filename: "{{ mypath | win_dirname }}"
|
||||
|
||||
RETURN:
|
||||
_value:
|
||||
description: The directory from the Windows path provided.
|
||||
|
||||
Reference in New Issue
Block a user