-
-
Notifications
You must be signed in to change notification settings - Fork 169
Getting the folder name #397
-
How can I get the current folder from the path?
For example if {path} is \\microserver\Downloads\complete\Test\advert.mpg.zero
I get
\\microserver\Downloads\/complete
Test/advert.mpg.zero
- (echo) Path is \\microserver\Downloads\complete\Test\advert.mpg.zero
- (echo) Relative Path is Test\advert.mpg.zero
- (echo) Name is advert.mpg
How can I get \\microserver\Downloads\complete\Test into, say, {folder} so that I can use something like
- shell: 'touch "{folder}\{name}"'
Here's my rule.
rules:
- name: Truncate To Zero
locations:
- path: \\\\microserver\\Downloads\\complete
subfolders: true
filters:
- name:
- extension: ["zero"]
actions:
- echo: Path is {path}
- echo: Relative Path is {relative_path}
- echo: Name is {name}
#- shell: 'touch "{folder}\\{name}"'
- delete:
tags:
- debug
Beta Was this translation helpful? Give feedback.
All reactions
I think you‘re searching for {path.parent}?
Replies: 1 comment 2 replies
-
I think you‘re searching for {path.parent}?
Beta Was this translation helpful? Give feedback.
All reactions
-
Perfect, but not in the docs :-(
Beta Was this translation helpful? Give feedback.
All reactions
-
We absolutely need better docs for this 👍
Right now there is only a link to pathlib.Path and the user is expected to know the rest.
Beta Was this translation helpful? Give feedback.