c# - While creating the directory I'm getting some sub directories instead? -
this code :
namespace testing { public partial class form1 : form { private string contentdirectory = ""; public form1() { initializecomponent(); string[] filescontent = directory.getfiles(@"c:\windows\minidump\"); string currentdate = datetime.now.toshortdatestring(); contentdirectory = path.getdirectoryname(application.localuserappdatapath) + "\\wm_" + currentdate; directory.createdirectory(contentdirectory); }
what want in end directory name :
c:\users\bout0_000\appdata\local\testing\testing\wm_27-03-13
instead im getting :
c:\users\bout0_000\appdata\local\testing\testing\wm_\23\97\13
why ?
and how can format current date : 27-03-13 , not 27/03/13
?
why ?
because date format of regional settings uses slashes separate parts. when concatenate file system path, subdirectories.
and how can format current date : 27-03-13 , not 27/03/13 ? instead / -
use datetime.now.tostring("dd-mm-yy")
Comments
Post a Comment