WinBatch® Technical Support Forum

All Things WinBatch => WinBatch => Topic started by: Franchise on July 17, 2020, 02:37:56 PM

Title: Grab data between two / in file directory
Post by: Franchise on July 17, 2020, 02:37:56 PM
Hello.  I am trying to get grab the word "Documents" in the following file directory example.  C:\Users\Franchise\Documents\Fishing Pics\

Thanks for the help.
Title: Re: Grab data between two / in file directory
Post by: ChuckC on July 17, 2020, 02:47:02 PM
Handle the path as if it were actually a list of string values delimited by the '\' path element separator.  Use the ItemCount() and ItemExtract() functions to pull out the element you want.
Title: Re: Grab data between two / in file directory
Post by: td on July 17, 2020, 02:49:14 PM
It depends on what your needs are but you can search and or extract a fold name using the Item* functions.  For example,
Code (winbatch) Select
nIndex = ItemLocate('Documents','C:\Users\Franchise\Documents\Fishing Pics\','\')

strItem = ItemExtract( nIndex, 'C:\Users\Franchise\Documents\Fishing Pics\', '\')