1
Reply

How do i get the Path.GetDirectoryName()of the file value

Cassie Mod

Cassie Mod

Jan 6 2016 10:07 AM
336
Ive got the following app.config.
However how do i get the Path.GetDirectoryName() of the file value ?
The reason i need it is because i olso have a function wich delete everey in that directory
 
app.config:
 
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<configSections>
<section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler,log4net, Version=1.2.13.0, Culture=neutral, PublicKeyToken=669e0ddf0bb1aa2a" />
</configSections>
<connectionStrings>
<add name="batch" connectionString="Data Source=87.237.31.230\LAB_TEST;Initial Catalog=CollectedFiles;User ID=sa;Password=ws2008_oxs" />
</connectionStrings>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.2" />
</startup>
<!--<system.net>
<mailSettings>
<smtp from="OneXS &lt;[email protected]&gt;">
<network host="smtp.uniserver.nl" port="2525" enableSsl="false" userName="actisfacturatinl" password="jcqb3u07s" />
</smtp>
</mailSettings>
</system.net>-->
<log4net>
<appender name="RollingFileAppender" type="log4net.Appender.RollingFileAppender">
<file value="c:\Log\LastExecutedBatch.Cmd" />
<staticLogFileName value="false" />
<appendToFile value="true" />
<rollingStyle value="Composite" />
<datePattern value="_yyyy.MM.dd.&quot;log&quot;" />
<maxSizeRollBackups value="10" />
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="%date{yyyy-MM-dd HH:mm:ss,fff} %-5level - %message%newline" />
</layout>
</appender>
<appender name="ColoredConsoleAppender" type="log4net.Appender.ColoredConsoleAppender">
<target value="Console.Error" />
<mapping>
<level value="FATAL" />
<foreColor value="Red" />
<backColor value="White" />
</mapping>
<mapping>
<level value="ERROR" />
<foreColor value="Red, HighIntensity" />
</mapping>
<mapping>
<level value="WARN" />
<foreColor value="Yellow" />
</mapping>
<mapping>
<level value="INFO" />
<foreColor value="Cyan" />
</mapping>
<mapping>
<level value="DEBUG" />
<foreColor value="Green" />
</mapping>
<layout type="log4net.Layout.SimpleLayout" />
</appender>
<appender name="EmailAppender" type="log4net.Appender.SmtpAppender">
<param name="Threshold" value="INFO" />
<subject value="Batch Error Report" />
<to value="[email protected]" />
<from value="BatchChecker &lt;[email protected]&gt;" />
<smtpHost value="smtp-out.onexs.com" />
<bufferSize value="1000" />
<lossy value="false" />
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="%date{yyyy-MM-dd HH:mm:ss,fff} %-5level - %message%newline" />
</layout>
</appender>
<root>
<level value="ALL" />
</root>
<logger name="OneXS">
<level value="ALL" />
<appender-ref ref="RollingFileAppender" />
<appender-ref ref="ColoredConsoleAppender" />
<appender-ref ref="EmailAppender" />
</logger>
</log4net>
</configuration> 
 
soo How should i do this ??
 
const string path = Path.GetDirectoryName(?????); --> file value
anyone got any idea ?? thnx  

Answers (1)