// DirectoryCreate.cpp : メイン プロジェクト ファイルです。 #include "stdafx.h" using namespace System; using namespace System::IO; int main(array ^args) { String^ path1 = "C:\\MyFolder\\Homepage\\public_html\\Cprpr\\CreateDirectory"; String^ path2 = "C:\\MyFolder\\Homepage\\public_html\\Cprpr\\CreateDirectory2"; Directory::CreateDirectory(path1); Console::WriteLine("{0} にディレクトリを作成しました。", path1); // Specify the directories you want to manipulate. DirectoryInfo^ di = gcnew DirectoryInfo(path2); try { // Determine whether the directory exists. if ( di->Exists ) { // Indicate that the directory already exists. Console::WriteLine( "That path exists already." ); return 0; } // Try to create the directory. di->Create(); Console::WriteLine( "The directory was created successfully." ); // Delete the directory. di->Delete(); Console::WriteLine( "The directory was deleted successfully." ); } catch ( Exception^ e ) { Console::WriteLine( "The process failed: {0}", e ); } return 0; }