1
I have a folder structure like this:
bco_img/3/foto_produto/
bco_img/3/foto_produto/tb/
bco_img/4/foto_produto/
bco_img/4/foto_produto/tb/
etc...
I want to recover the folder /3/ after /4/ and also the name of the photos that are inside each folder, e.g.: folder: /3/ photo: Xyz.jpg I did something like this:
string url_Fonte = Server.MapPath("BCO_IMG");
DirectoryInfo diretorio = new DirectoryInfo(url_Fonte);
   FileInfo[] Arquivos = diretorio.GetFiles("*.jpg", SearchOption.AllDirectories);
      foreach (FileInfo fileinfo in Arquivos)
      {
       string nome_dir =  fileinfo.DirectoryName;
       string v1 = nome_dir.IndexOf(@"BCO_IMG\").ToString();
    // aqui qual é o melhor? fazer uma função para recuperar pelo indexOF ou criar um Array com Split() ?
      string nome_foto = fileinfo.Name;
      }
Is this what you want? http://answall.com/questions/35400/como-obten-um-trecho-de-umastring/35401#35401
– Maniero