Page 1 of 1

Remove part of a file name

Posted: Thu Jul 31, 2025 6:38 pm
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="_"]

Re: Remove part of a file name

Posted: Thu Jul 31, 2025 8:22 pm
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

Re: Remove part of a file name

Posted: Fri Aug 01, 2025 9:34 am
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.

Re: Remove part of a file name

Posted: Mon Aug 04, 2025 3:26 pm
by Richardbis
Thank you! This is good to know.