Remove part of a file name

Post Reply
Richardbis
Newbie
Posts: 3
Joined: Thu Jul 24, 2025 7:20 pm

Remove part of a file name

Post by Richardbis »

I am very new to Switch, so please forgive what might be a easy question to you

I am trying to get files into a folder that is already created -- problem seems that the file name has the additional info in it separated by "_"
So I need my Path to find the folder that is named "123456_Customername" -- From a file named "123456_Customername_Labels" and place that file in that folder with the file name in tact

I have tried to use [Job.NameProper] and [Job.NameProper:Before="_"]
Richardbis
Newbie
Posts: 3
Joined: Thu Jul 24, 2025 7:20 pm

Re: Remove part of a file name

Post by Richardbis »

I figured it out with a little help from my friend Grok
[Job.NameProper:Search="^(\d{6}_[^_]+)"] seems to be working well - Thanks
freddyp
Advanced member
Posts: 1141
Joined: Thu Feb 09, 2012 3:53 pm

Re: Remove part of a file name

Post by freddyp »

That is indeed the most efficient way for your use case.

For the sake of education, there is another possible approach: the app StringSplitter (https://www0.enfocus.com/en/appstore/pr ... ngsplitter). This app creates private data for each part of a string based on a certain separator, underscore in your case. You can then recombine part 1 with part 2. Again, for your use case the StringSplitter approach is less efficient, but if you needed to recombine part 1 with part 4 and then part 2, for example, you would need it.
Richardbis
Newbie
Posts: 3
Joined: Thu Jul 24, 2025 7:20 pm

Re: Remove part of a file name

Post by Richardbis »

Thank you! This is good to know.
Post Reply