# Python request... copy path but remove some part

**URL:** <https://forum.logik.tv/t/python-request-copy-path-but-remove-some-part/8156>\
**Category:** Python\
**Tags:** python\
**Created:** [April 13, 2023, 4:49pm UTC](https://forum.logik.tv/t/python-request-copy-path-but-remove-some-part/8156 "2023-04-13T16:49:21Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![bryanb](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.logik.tv/bryanb/32/136_2.png) [@bryanb](https://forum.logik.tv/u/bryanb)\
**Post date:** [April 13, 2023, 4:49pm UTC](https://forum.logik.tv/t/python-request-copy-path-but-remove-some-part/8156/1 "2023-04-13T16:49:22Z")

</div>

I use the Clip Path to Clipboard script from Michael Vaglienty. Works great.

But when I’m sending that path to another artist (via slack) I only need the path relative to the job we’re working on. So I’m trying to figure out the best way to copy the path, but only whatever is after something like: /Volumes/JobName/

Any thoughts?

---

<div class="post-metadata">

**Author:** ![john-geehreng](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.logik.tv/john-geehreng/32/7195_2.png) [@john-geehreng](https://forum.logik.tv/u/john-geehreng)\
**Post date:** [April 13, 2023, 5:06pm UTC](https://forum.logik.tv/t/python-request-copy-path-but-remove-some-part/8156/2 "2023-04-13T17:06:02Z")

</div>

Hey Bryan,

What about something like this?

```auto
job_name = "/Volumes/" + flame.project.current_project.nickname + "/"

for item in selection:
    file_path = item.path
#Remove /Volumes/JobName
slack_path = file_path.replace('job_name,'')

qt_app_instance = QtWidgets.QApplication.instance()
qt_app_instance.clipboard().setText(slack_path)

```

Edit:  
You could also try splitting it after the 2nd or 3rd “/”

> <https://stackoverflow.com/questions/36300158/split-text-after-the-second-occurrence-of-character>

---

<div class="post-metadata">

**Author:** ![bryanb](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.logik.tv/bryanb/32/136_2.png) [@bryanb](https://forum.logik.tv/u/bryanb)\
**Post date:** [April 13, 2023, 5:08pm UTC](https://forum.logik.tv/t/python-request-copy-path-but-remove-some-part/8156/3 "2023-04-13T17:08:37Z")

</div>

Ah Nice - I was trying to remove part but it looks like you are replacing it (with nothing).

I’ll try this.

Edit - Also need to have the flame project name match the ‘job folder’ name which I try to do.
