Quantcast
Channel: The Official Scripting Guys Forum! forum
Viewing all articles
Browse latest Browse all 15028

Powershell Splitting file name issue

$
0
0

Hey guys,

       I have an issue with splitting a file name and assigning the splits to variables to i can write them to a SQL database.

my sample file name is: I12345L98765.tif where this variable is $name

what im using is 

      $splitup=$name -split'[I,L,.]'
      $item=$splitup[1]
      $lot=$splitup[2]

Then i'm trying to write the $item and $lot to a SQL database. 

Two problems i'm having is the the $lot doesnt always seem to get data and secondly if my sample file name has to characters the same ie: I12345LL98765.tif the variable never gets passed at all.

If hope i was clear in my explanation. Any help is greatly appreciated.

Thanks

Rich T.




Rich Thompson


Viewing all articles
Browse latest Browse all 15028

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>