IT rekvalifikace s garancí práce. Seniorní programátoři vydělávají až 160 000 Kč/měsíc a rekvalifikace je prvním krokem. Zjisti, jak na to!
Hledáme nové posily do ITnetwork týmu. Podívej se na volné pozice a přidej se do nejagilnější firmy na trhu - Více informací.

Diskuze: Nastavení cesty ze souboru

V předchozím kvízu, Test znalostí C# .NET online, jsme si ověřili nabyté zkušenosti z kurzu.

Aktivity
Avatar
Kamil
Člen
Avatar
Kamil:2.5.2019 17:19

Ahoj,
Potřeboval bych přečíst cestu ze souboru který se vždy nachází na stejném místě.
C:\Users\kpo\Do­cuments\pamscl­.dat
Je to texťák s příponou .dat
V jeho prvním řádku je např:v46_fan_16­r2_igw_v1-1-14-hlava 8.tcp,,,K:\Pr­ogrammers\Tur­ning\TURN\S\STM\stm0­015083\B\zfinal\stm00150­83_40op.nc,K:\Pro­grammers\Turnin­g\TURN\S\STM\stm0­015083\B\zfinal\stm00150­83_40op.ppf,0,5897

Potřebuji přečíst K:\Programmer­s\Turning\TUR­N\S\STM\stm0015083\B\zfi­nal\ což je cesta která se ale mění může být třeba K:\Programmer­s\Turning\TUR­N\C\CZR\CZR0000012\A\pla­n1\0\ a tu použít jako zdroj ze kterého vyjme soubory s příponou *.txt a *.nc
Ty pak přesune do patřičných adresářů dle kritérií které jsou již nastaveny.

Děkuji Kamil

Zkusil jsem: using System;
using System.Collec­tions.Generic;
using System.Componen­tModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Window­s.Forms;
using System.IO;
using System.Diagnostics;

namespace KPO_moving_files
{
public partial class Form1 : Form
{
public Form1()
{
InitializeCom­ponent();
}

private void button1_Click(ob­ject sender, EventArgs e)
{
String directoryNc = "L:\\Method\\Pro­grammers\\CAM3\\CAM­_OUTPUT\\1-Edgecam";
String directoryCasV26 = "L:\\Method\\Pro­grammers\\CAM3\\SE­RIZOVACI_CASY\\V26";
String directoryCasV36 = "L:\\Method\\Pro­grammers\\CAM3\\SE­RIZOVACI_CASY\\V36";
String directoryCasV46 = "L:\\Method\\Pro­grammers\\CAM3\\SE­RIZOVACI_CASY\\V46";
String directoryCasV300 = "L:\\Method\\Pro­grammers\\CAM3\\SE­RIZOVACI_CASY\\VT300";
String directoryNastro­jeV26 = "L:\\DNC\\Vic­tor26\\Nastro­jove_listy";
String directoryNastro­jeV36 = "L:\\DNC\\Vic­tor36\\Nastro­jove_listy";
String directoryNastro­jeV46 = "L:\\DNC\\Vic­tor46\\Nastro­jove_listy";
String directoryNastro­jeV300 = "L:\\DNC\\V30­0\\Nastrojove_lis­ty";
String directoryVerzeV26 = "L:\\Method\\Pro­grammers\\CAM3\\VER­ZE_TURN_PROGRA­MU\\V26";
String directoryVerzeV36 = "L:\\Method\\Pro­grammers\\CAM3\\VER­ZE_TURN_PROGRA­MU\\V36";
String directoryVerzeV46 = "L:\\Method\\Pro­grammers\\CAM3\\VER­ZE_TURN_PROGRA­MU\\V46";
String directoryVerzeV300 = "L:\\Method\\Pro­grammers\\CAM3\\VER­ZE_TURN_PROGRA­MU\\VT300";
String directoryData­bazeTurn = "L:\\Method\\Pro­grammers\\CAM3";

DirectoryInfo dirNc = new DirectoryInfo(di­rectoryNc);
DirectoryInfo dirCasV26 = new DirectoryInfo(di­rectoryCasV26);
DirectoryInfo dirCasV36 = new DirectoryInfo(di­rectoryCasV36);
DirectoryInfo dirCasV46 = new DirectoryInfo(di­rectoryCasV46);
DirectoryInfo dirCasV300 = new DirectoryInfo(di­rectoryCasV300);
DirectoryInfo dirNastrojeV26 = new DirectoryInfo(di­rectoryNastro­jeV26);
DirectoryInfo dirNastrojeV36 = new DirectoryInfo(di­rectoryNastro­jeV36);
DirectoryInfo dirNastrojeV46 = new DirectoryInfo(di­rectoryNastro­jeV46);
DirectoryInfo dirNastrojeV300 = new DirectoryInfo(di­rectoryNastro­jeV300);
DirectoryInfo dirVerzeV26 = new DirectoryInfo(di­rectoryVerzeV26);
DirectoryInfo dirVerzeV36 = new DirectoryInfo(di­rectoryVerzeV36);
DirectoryInfo dirVerzeV46 = new DirectoryInfo(di­rectoryVerzeV46);
DirectoryInfo dirVerzeV300 = new DirectoryInfo(di­rectoryVerzeV300);
DirectoryInfo dirDatabazeTurn = new DirectoryInfo(di­rectoryDataba­zeTurn);

if (dirNc.Exists == false) Directory.Cre­ateDirectory(di­rectoryNc);
if (dirCasV26.Exists == false) Directory.Cre­ateDirectory(di­rectoryCasV26);
if (dirCasV36.Exists == false) Directory.Cre­ateDirectory(di­rectoryCasV36);
if (dirCasV46.Exists == false) Directory.Cre­ateDirectory(di­rectoryCasV46);
if (dirCasV300.Exists == false) Directory.Cre­ateDirectory(di­rectoryCasV300);
if (dirNastrojeV26­.Exists == false) Directory.Cre­ateDirectory(di­rectoryNastro­jeV26);
if (dirNastrojeV36­.Exists == false) Directory.Cre­ateDirectory(di­rectoryNastro­jeV36);
if (dirNastrojeV46­.Exists == false) Directory.Cre­ateDirectory(di­rectoryNastro­jeV46);
if (dirNastrojeV300­.Exists == false) Directory.Cre­ateDirectory(di­rectoryNastro­jeV300);
if (dirVerzeV26.Exists == false) Directory.Cre­ateDirectory(di­rectoryVerzeV26);
if (dirVerzeV36.Exists == false) Directory.Cre­ateDirectory(di­rectoryVerzeV36);
if (dirVerzeV46.Exists == false) Directory.Cre­ateDirectory(di­rectoryVerzeV46);
if (dirVerzeV300­.Exists == false) Directory.Cre­ateDirectory(di­rectoryVerzeV300);
if (dirDatabazeTur­n.Exists == false) Directory.Cre­ateDirectory(di­rectoryDataba­zeTurn);

List<String> K_Ncfiles = Directory.Get­Files("K:\\Pro­grammers\\Tur­ning\\TURN", "*.nc", SearchOption.A­llDirectories)­.ToList();
List<String> K_CasfilesV26 = Directory.Get­Files("K:\\Pro­grammers\\Tur­ning\\TURN", "*CAS_V26.TXT", SearchOption.A­llDirectories)­.ToList();
List<String> K_CasfilesV36 = Directory.Get­Files("K:\\Pro­grammers\\Tur­ning\\TURN", "*CAS_V36.TXT", SearchOption.A­llDirectories)­.ToList();
List<String> K_CasfilesV46 = Directory.Get­Files("K:\\Pro­grammers\\Tur­ning\\TURN", "*CAS_V46.TXT", SearchOption.A­llDirectories)­.ToList();
List<String> K_CasfilesV300 = Directory.Get­Files("K:\\Pro­grammers\\Tur­ning\\TURN", "*CAS_V300.TXT", SearchOption.A­llDirectories)­.ToList();
List<String> K_NastrojefilesV26 = Directory.Get­Files("K:\\Pro­grammers\\Tur­ning\\TURN", "*NASTROJE_V26­.TXT", SearchOption.A­llDirectories)­.ToList();
List<String> K_NastrojefilesV36 = Directory.Get­Files("K:\\Pro­grammers\\Tur­ning\\TURN", "*NASTROJE_V36­.TXT", SearchOption.A­llDirectories)­.ToList();
List<String> K_NastrojefilesV46 = Directory.Get­Files("K:\\Pro­grammers\\Tur­ning\\TURN", "*NASTROJE_V46­.TXT", SearchOption.A­llDirectories)­.ToList();
List<String> K_NastrojefilesV300 = Directory.Get­Files("K:\\Pro­grammers\\Tur­ning\\TURN", "*NASTROJE_V300­.TXT", SearchOption.A­llDirectories)­.ToList();
List<String> K_VerzefilesV26 = Directory.Get­Files("K:\\Pro­grammers\\Tur­ning\\TURN", "EDITACE_V26.TXT", SearchOption.A­llDirectories)­.ToList();
List<String> K_VerzefilesV36 = Directory.Get­Files("K:\\Pro­grammers\\Tur­ning\\TURN", "EDITACE_V36.TXT", SearchOption.A­llDirectories)­.ToList();
List<String> K_VerzefilesV46 = Directory.Get­Files("K:\\Pro­grammers\\Tur­ning\\TURN", "EDITACE_V46.TXT", SearchOption.A­llDirectories)­.ToList();
List<String> K_VerzefilesV300 = Directory.Get­Files("K:\\Pro­grammers\\Tur­ning\\TURN", "EDITACE_V300­.TXT", SearchOption.A­llDirectories)­.ToList();
List<String> K_DatabazeTurn = Directory.Get­Files("L:\\Met­hod\\TECHNOL\\TUR­NING_PROGRAMS", "Databaze_tur­n.xls", SearchOption.A­llDirectories)­.ToList();

//Nc programy
foreach (string Ncfile in K_Ncfiles)
{
FileInfo NcFilename = new FileInfo(Ncfile);
// to remove name collusion
//if (new FileInfo(dirInfo + "\\" + mFile.Name).Exists == false)
NcFilename.Co­pyTo((dirNc + "\\" + NcFilename.Name), true);
}

foreach (string Ncfile in K_Ncfiles)
{
File.Delete(Ncfi­le);
}

//*********VIC­TOR26**********
//Cas V26
foreach (string CasfileV26 in K_CasfilesV26)
{
FileInfo CasFilenameV26 = new FileInfo(Casfi­leV26);
// to remove name collusion
//if (new FileInfo(dirInfo + "\\" + mFile.Name).Exists == false)
CasFilenameV26­.CopyTo((dirCas­V26 + "\\" + CasFilenameV26­.Name), true);
}

foreach (string CasfileV26 in K_CasfilesV26)
{
File.Delete(Cas­fileV26);
}

//Nástroje V26
foreach (string NastrojefileV26 in K_NastrojefilesV26)
{
FileInfo NastrojeFilenameV26 = new FileInfo(Nastro­jefileV26);
// to remove name collusion
//if (new FileInfo(dirInfo + "\\" + mFile.Name).Exists == false)
NastrojeFilena­meV26.CopyTo((dir­NastrojeV26 + "\\" + NastrojeFilena­meV26.Name), true);
}

foreach (string NastrojefileV26 in K_NastrojefilesV26)
{
File.Delete(Nas­trojefileV26);
}

//Verze V26
foreach (string VerzefileV26 in K_VerzefilesV26)
{
FileInfo VerzeFilenameV26 = new FileInfo(Verze­fileV26);
// to remove name collusion
//if (new FileInfo(dirInfo + "\\" + mFile.Name).Exists == false)
VerzeFilenameV26­.CopyTo((dirVer­zeV26 + "\\" + VerzeFilenameV26­.Name), true);
}

foreach (string VerzefileV26 in K_VerzefilesV26)
{
File.Delete(Ver­zefileV26);
}

//*********VIC­TOR36**********
//Cas V36
foreach (string CasfileV36 in K_CasfilesV36)
{
FileInfo CasFilenameV36 = new FileInfo(Casfi­leV36);
// to remove name collusion
//if (new FileInfo(dirInfo + "\\" + mFile.Name).Exists == false)
CasFilenameV36­.CopyTo((dirCas­V36 + "\\" + CasFilenameV36­.Name), true);
}

foreach (string CasfileV36 in K_CasfilesV36)
{
File.Delete(Cas­fileV36);
}

//Nástroje V36
foreach (string NastrojefileV36 in K_NastrojefilesV36)
{
FileInfo NastrojeFilenameV36 = new FileInfo(Nastro­jefileV36);
// to remove name collusion
//if (new FileInfo(dirInfo + "\\" + mFile.Name).Exists == false)
NastrojeFilena­meV36.CopyTo((dir­NastrojeV36 + "\\" + NastrojeFilena­meV36.Name), true);
}

foreach (string NastrojefileV36 in K_NastrojefilesV36)
{
File.Delete(Nas­trojefileV36);
}

//Verze V36
foreach (string VerzefileV36 in K_VerzefilesV36)
{
FileInfo VerzeFilenameV36 = new FileInfo(Verze­fileV36);
// to remove name collusion
//if (new FileInfo(dirInfo + "\\" + mFile.Name).Exists == false)
VerzeFilenameV36­.CopyTo((dirVer­zeV36 + "\\" + VerzeFilenameV36­.Name), true);
}

foreach (string VerzefileV36 in K_VerzefilesV36)
{
File.Delete(Ver­zefileV36);
}

//*********VIC­TOR46**********
//Cas V46
foreach (string CasfileV46 in K_CasfilesV46)
{
FileInfo CasFilenameV46 = new FileInfo(Casfi­leV46);
// to remove name collusion
//if (new FileInfo(dirInfo + "\\" + mFile.Name).Exists == false)
CasFilenameV46­.CopyTo((dirCas­V46 + "\\" + CasFilenameV46­.Name), true);
}

foreach (string CasfileV46 in K_CasfilesV46)
{
File.Delete(Cas­fileV46);
}

//Nástroje V46
foreach (string NastrojefileV46 in K_NastrojefilesV46)
{
FileInfo NastrojeFilenameV46 = new FileInfo(Nastro­jefileV46);
// to remove name collusion
//if (new FileInfo(dirInfo + "\\" + mFile.Name).Exists == false)
NastrojeFilena­meV46.CopyTo((dir­NastrojeV46 + "\\" + NastrojeFilena­meV46.Name), true);
}

foreach (string NastrojefileV46 in K_NastrojefilesV46)
{
File.Delete(Nas­trojefileV46);
}

//Verze V46
foreach (string VerzefileV46 in K_VerzefilesV46)
{
FileInfo VerzeFilenameV46 = new FileInfo(Verze­fileV46);
// to remove name collusion
//if (new FileInfo(dirInfo + "\\" + mFile.Name).Exists == false)
VerzeFilenameV46­.CopyTo((dirVer­zeV46 + "\\" + VerzeFilenameV46­.Name), true);
}

foreach (string VerzefileV46 in K_VerzefilesV46)
{
File.Delete(Ver­zefileV46);
}

//*********VIC­TOR300**********
//Cas V300
foreach (string CasfileV300 in K_CasfilesV300)
{
FileInfo CasFilenameV300 = new FileInfo(Casfi­leV300);
// to remove name collusion
//if (new FileInfo(dirInfo + "\\" + mFile.Name).Exists == false)
CasFilenameV300­.CopyTo((dirCas­V300 + "\\" + CasFilenameV300­.Name), true);
}

foreach (string CasfileV300 in K_CasfilesV300)
{
File.Delete(Cas­fileV300);
}

//Nástroje V300
foreach (string NastrojefileV300 in K_Nastrojefiles­V300)
{
FileInfo NastrojeFilena­meV300 = new FileInfo(Nastro­jefileV300);
// to remove name collusion
//if (new FileInfo(dirInfo + "\\" + mFile.Name).Exists == false)
NastrojeFilena­meV300.CopyTo((dir­NastrojeV300 + "\\" + NastrojeFilena­meV300.Name), true);
}

foreach (string NastrojefileV300 in K_Nastrojefiles­V300)
{
File.Delete(Nas­trojefileV300);
}

//Verze V300
foreach (string VerzefileV300 in K_VerzefilesV300)
{
FileInfo VerzeFilenameV300 = new FileInfo(Verze­fileV300);
// to remove name collusion
//if (new FileInfo(dirInfo + "\\" + mFile.Name).Exists == false)
VerzeFilenameV300­.CopyTo((dirVer­zeV300 + "\\" + VerzeFilenameV300­.Name), true);
}

foreach (string VerzefileV300 in K_VerzefilesV300)
{
File.Delete(Ver­zefileV300);
}

//Databáze Turn
foreach (string DatabazeTurn in K_DatabazeTurn)
{
FileInfo DatabazeTurnFi­lename = new FileInfo(Data­bazeTurn);
// to remove name collusion
//if (new FileInfo(dirInfo + "\\" + mFile.Name).Exists == false)
DatabazeTurnFi­lename.CopyTo((dir­DatabazeTurn + "\\" + DatabazeTurnFi­lename.Name), true);
}

//foreach (string Ncfile in K_Ncfiles)
{
// File.Delete(Ncfi­le);
}

}

private void button2_Click(ob­ject sender, EventArgs e)
{
Process.Start(@"L:\Met­hod\Programmer­s\CAM3\CAM_OUT­PUT\1-Edgecam");
}

private void button3_Click(ob­ject sender, EventArgs e)
{
Process.Start(@"L:\Met­hod\Programmer­s\CAM3\SERIZO­VACI_CASY");
}

private void button4_Click(ob­ject sender, EventArgs e)
{
Process.Start(@"L:\DNC\V­300\Nastrojove_lis­ty");
}

private void button5_Click(ob­ject sender, EventArgs e)
{
Process.Start(@"L:\DNC\V­ictor26\Nastro­jove_listy");
}

private void button6_Click(ob­ject sender, EventArgs e)
{
Process.Start(@"L:\DNC\V­ictor36\Nastro­jove_listy");
}

private void button7_Click(ob­ject sender, EventArgs e)
{
Process.Start(@"L:\DNC\V­ictor46\Nastro­jove_listy");
}

private void button8_Click(ob­ject sender, EventArgs e)
{
Process.Start(@"L:\Met­hod\Programmer­s\CAM3\VERZE_TUR­N_PROGRAMU");
}

private void button9_Click(ob­ject sender, EventArgs e)
{
Process.Start(@"L:\Met­hod\Programmer­s\CAM3");
}

private void button10_Clic­k(object sender, EventArgs e)
{
Process.Start(@"L:\DNC");
}
}
}

 
Odpovědět
2.5.2019 17:19
Avatar
JerryM
Člen
Avatar
JerryM:3.5.2019 7:28

List<String> fullPath = new List<String>();

StreamReader sr = new StreamReader(Fi­le.Open ..... atd)
while ( sr.EndOfStream == false )
{
fullPath.Add( sr.ReadLine);
}
sr.Close();
sr=null;

 
Nahoru Odpovědět
3.5.2019 7:28
Avatar
plelovsky
Člen
Avatar
Odpovídá na Kamil
plelovsky:3.5.2019 8:44

A co ti nejde - číst ze souboru, získat z 1. řádku tu cestu, ...?

 
Nahoru Odpovědět
3.5.2019 8:44
Avatar
Kamil
Člen
Avatar
Odpovídá na plelovsky
Kamil:3.5.2019 14:12

Jj přesně tak jak získat tu cestu.
Ta cesta se ale mění.
tento základ je stále stejný
K:\Programmer­s\Turning\TUR­N\
ta další část se mění jak názvem tak délkou.

 
Nahoru Odpovědět
3.5.2019 14:12
Avatar
Odpovídá na Kamil
Michal Štěpánek:4.5.2019 10:36

Existuje tam v tom řetězci něco, co jednoznačně (a pořád stejně) označí konec té cesty? Např. tečka, čárka, mezera, nebo nějaká kombinace znaků?

Nahoru Odpovědět
4.5.2019 10:36
Nikdy neříkej nahlas, že to nejde. Vždycky se totiž najde blbec, který to neví a udělá to...
Avatar
Odpovídá na Kamil
Michal Štěpánek:4.5.2019 10:40

V té cestě by podle mě neměla být čárka, takže by se dalo "odpíchnout" třeba od ní...
Např.: při procházení budeš hledat znaky zpětného lomítka a pokud mezi nimi bude čárka, tak to poslední lomítko by mělo být posledním znakem cesty...

Nahoru Odpovědět
4.5.2019 10:40
Nikdy neříkej nahlas, že to nejde. Vždycky se totiž najde blbec, který to neví a udělá to...
Avatar
Kamil
Člen
Avatar
Odpovídá na Michal Štěpánek
Kamil:6.5.2019 15:26

V té ceste je vždy název souboru který je s příponou *.nc ale název souboru se mění.

 
Nahoru Odpovědět
6.5.2019 15:26
Avatar
plelovsky
Člen
Avatar
plelovsky:6.5.2019 17:50

Vypadá to, že v tom 1. řádku jsou hodnoty oddělené čárkama. Pokud je struktura řádku stále stejná, pak můžeš cestu získat např takto:

static string GetDir(string cfg)
{
    string fn = null;
    string dir = null;
    try
    {
        using (StreamReader sr = new StreamReader(cfg))
        {
            fn = sr.ReadLine();
        }
        if (!string.IsNullOrEmpty(fn))
        {
            string[] arr = fn.Split(new char[] { ',' });
            if (arr.Length >= 4)
            {
                dir = Path.GetDirectoryName(arr[3]);
            }
        }
    }
    catch (Exception e)
    { }
    return dir;
}

Vstupní parametr je jméno souboru C:\Users\kpo\Do­cuments\pamscl­.dat
Výstup je K:\Programmer­s\Turning\TUR­N\S\STM\stm0015083\B\zfi­nal
pokud se něco nepovede, je výstup null nebo prázdný string - lze otestovat pomocí string.IsNullO­rEmpty()

 
Nahoru Odpovědět
6.5.2019 17:50
Avatar
Kamil
Člen
Avatar
Odpovídá na plelovsky
Kamil:9.5.2019 12:41

Děkuji za výpis ale jsem úplný laik co se týče C# takže nevím kam to zakomponovat aby to fungovalo po stisku tlačítka1 a následně nahrazoval starou cestu novou tady v tomto.
List<String> K_Ncfiles = Directory.Get­Files("K:\\Pro­grammers\\Tur­ning\\TURN", "*.nc", SearchOption.A­llDirectories)­.ToList();
List<String> K_CasfilesV26 = Directory.Get­Files("K:\\Pro­grammers\\Tur­ning\\TURN", "*CAS_V26.TXT", SearchOption.A­llDirectories)­.ToList();
List<String> K_CasfilesV36 = Directory.Get­Files("K:\\Pro­grammers\\Tur­ning\\TURN", "*CAS_V36.TXT", SearchOption.A­llDirectories)­.ToList();
List<String> K_CasfilesV46 = Directory.Get­Files("K:\\Pro­grammers\\Tur­ning\\TURN", "*CAS_V46.TXT", SearchOption.A­llDirectories)­.ToList();
List<String> K_CasfilesV300 = Directory.Get­Files("K:\\Pro­grammers\\Tur­ning\\TURN", "*CAS_V300.TXT", SearchOption.A­llDirectories)­.ToList();
List<String> K_NastrojefilesV26 = Directory.Get­Files("K:\\Pro­grammers\\Tur­ning\\TURN", "*NASTROJE_V26­.TXT", SearchOption.A­llDirectories)­.ToList();
List<String> K_NastrojefilesV36 = Directory.Get­Files("K:\\Pro­grammers\\Tur­ning\\TURN", "*NASTROJE_V36­.TXT", SearchOption.A­llDirectories)­.ToList();
List<String> K_NastrojefilesV46 = Directory.Get­Files("K:\\Pro­grammers\\Tur­ning\\TURN", "*NASTROJE_V46­.TXT", SearchOption.A­llDirectories)­.ToList();
List<String> K_NastrojefilesV300 = Directory.Get­Files("K:\\Pro­grammers\\Tur­ning\\TURN", "*NASTROJE_V300­.TXT", SearchOption.A­llDirectories)­.ToList();
List<String> K_VerzefilesV26 = Directory.Get­Files("K:\\Pro­grammers\\Tur­ning\\TURN", "EDITACE_V26.TXT", SearchOption.A­llDirectories)­.ToList();
List<String> K_VerzefilesV36 = Directory.Get­Files("K:\\Pro­grammers\\Tur­ning\\TURN", "EDITACE_V36.TXT", SearchOption.A­llDirectories)­.ToList();
List<String> K_VerzefilesV46 = Directory.Get­Files("K:\\Pro­grammers\\Tur­ning\\TURN", "EDITACE_V46.TXT", SearchOption.A­llDirectories)­.ToList();
List<String> K_VerzefilesV300 = Directory.Get­Files("K:\\Pro­grammers\\Tur­ning\\TURN", "EDITACE_V300.TXT", SearchOption.A­llDirectories)­.ToList();

 
Nahoru Odpovědět
9.5.2019 12:41
Avatar
plelovsky
Člen
Avatar
Odpovídá na Kamil
plelovsky:9.5.2019 13:19
string dir = GetDir("C:\\Users\\kpo\\Documents\\pamscl.dat");
if (!string.IsNullOrEmpty(dir))
{
    List<String> K_Ncfiles = Directory.GetFiles(dir, "*.nc", SearchOption.AllDirectories).ToList();
    List<String> K_CasfilesV26 = Directory.GetFiles(dir, "*CAS_V26.TXT", SearchOption.AllDirectories).ToList();
    List<String> K_CasfilesV36 = Directory.GetFiles(dir, "*CAS_V36.TXT", SearchOption.AllDirectories).ToList();
    List<String> K_CasfilesV46 = Directory.GetFiles(dir, "*CAS_V46.TXT", SearchOption.AllDirectories).ToList();
    List<String> K_CasfilesV300 = Directory.GetFiles(dir, "*CAS_V300.TXT", SearchOption.AllDirectories).ToList();
    List<String> K_NastrojefilesV26 = Directory.GetFiles(dir, "*NASTROJE_V26.TXT", SearchOption.AllDirectories).ToList();
    List<String> K_NastrojefilesV36 = Directory.GetFiles(dir, "*NASTROJE_V36.TXT", SearchOption.AllDirectories).ToList();
    List<String> K_NastrojefilesV46 = Directory.GetFiles(dir, "*NASTROJE_V46.TXT", SearchOption.AllDirectories).ToList();
    List<String> K_NastrojefilesV300 = Directory.GetFiles(dir, "*NASTROJE_V300.TXT", SearchOption.AllDirectories).ToList();
    List<String> K_VerzefilesV26 = Directory.GetFiles(dir, "EDITACE_V26.TXT", SearchOption.AllDirectories).ToList();
    List<String> K_VerzefilesV36 = Directory.GetFiles(dir, "EDITACE_V36.TXT", SearchOption.AllDirectories).ToList();
    List<String> K_VerzefilesV46 = Directory.GetFiles(dir, "EDITACE_V46.TXT", SearchOption.AllDirectories).ToList();
    List<String> K_VerzefilesV300 = Directory.GetFiles(dir, "EDITACE_V300.TXT", SearchOption.AllDirectories).ToList();
}
 
Nahoru Odpovědět
9.5.2019 13:19
Děláme co je v našich silách, aby byly zdejší diskuze co nejkvalitnější. Proto do nich také mohou přispívat pouze registrovaní členové. Pro zapojení do diskuze se přihlas. Pokud ještě nemáš účet, zaregistruj se, je to zdarma.

Zobrazeno 10 zpráv z 10.