Announcement

Collapse
No announcement yet.

Programm zum Sortieren

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Programm zum Sortieren

    Hey Leute !

    Ich hab mich seit 2 Tagen mit einem neuen Projekt beschäftigt und bin heute fertig geworden! Mein Programm ist ein simples Sortierungsprogramm, dass Dateien nach
    • Erstellungsdatum
    • Dateiendung
    • Anfangsbuchstaben bzw. -zahl
    • Dateigröße
    in die entsprechenden Ordner kopiert. Da ich dachte, dass vielleicht jemand von meinem Quellcode profitieren könnte, wollte ich hier mal meinen Quelltext veröffentlichen. Es wurde mit Visual C++ 9.0 Express Edition erstellt. Ich wäre auch sehr froh über Feetbacks.

    Hier könnt ihr euch das Programm kompiliert + Quelltext herunterladen :
    http://rapidshare.com/files/15393758...chine.zip.html


    Form1.h :
    Code:
    #pragma once
    
    
    namespace SortMachine {
    
    	using namespace System;
    	using namespace System::ComponentModel;
    	using namespace System::Collections;
    	using namespace System::Windows::Forms;
    	using namespace System::Data;
    	using namespace System::Drawing;
    
    	/// <summary>
    	/// Zusammenfassung für Form1
    	///
    	/// Warnung: Wenn Sie den Namen dieser Klasse ändern, müssen Sie auch
    	///          die Ressourcendateiname-Eigenschaft für das Tool zur Kompilierung verwalteter Ressourcen ändern,
    	///          das allen RESX-Dateien zugewiesen ist, von denen diese Klasse abhängt.
    	///          Anderenfalls können die Designer nicht korrekt mit den lokalisierten Ressourcen
    	///          arbeiten, die diesem Formular zugewiesen sind.
    	/// </summary>
    	public ref class Form1 : public System::Windows::Forms::Form
    	{
    	public:
    		Form1(void)
    		{
    			InitializeComponent();
    			this->textBox1->Hide();
    			this->textBox2->Hide();
    			this->textBox3->Hide();
    			this->button1->Enabled = false;
    			this->button2->Enabled = false;
    			this->button3->Enabled = false;
    			this->label3->Text = "Suche : ";
    			this->label4->Text = "Ziel     : ";
    			//
    			//TODO: Konstruktorcode hier hinzufügen.
    			//
    		}
    
    	protected:
    		/// <summary>
    		/// Verwendete Ressourcen bereinigen.
    		/// </summary>
    		~Form1()
    		{
    			if (components)
    			{
    				delete components;
    			}
    		}
    	private: System::Windows::Forms::Label^  label1;
    	protected: 
    
    
    
    
    	private: System::Windows::Forms::FolderBrowserDialog^  folderBrowserDialog1;
    	private: System::Windows::Forms::GroupBox^  groupBox1;
    	private: System::Windows::Forms::RadioButton^  radioButton4;
    	private: System::Windows::Forms::RadioButton^  radioButton3;
    	private: System::Windows::Forms::RadioButton^  radioButton2;
    	private: System::Windows::Forms::RadioButton^  radioButton1;
    	private: System::Windows::Forms::Label^  label2;
    	private: System::Windows::Forms::CheckBox^  checkBox1;
    	private: System::Windows::Forms::CheckBox^  checkBox2;
    	private: System::Windows::Forms::CheckBox^  checkBox3;
    	private: System::Windows::Forms::Button^  button1;
    	private: System::Windows::Forms::Button^  button2;
    	private: System::Windows::Forms::Button^  button3;
    	private: System::Windows::Forms::Button^  button4;
    	private: System::Windows::Forms::Button^  button5;
    	private: System::Windows::Forms::TextBox^  textBox1;
    	private: System::Windows::Forms::TextBox^  textBox2;
    	private: System::Windows::Forms::TextBox^  textBox3;
    	private: System::Windows::Forms::FolderBrowserDialog^  folderBrowserDialog2;
    	private: System::Windows::Forms::Label^  label3;
    	private: System::Windows::Forms::Label^  label4;
    
    
    
    
    
    	private:
    		/// <summary>
    		/// Erforderliche Designervariable.
    		/// </summary>
    		System::ComponentModel::Container ^components;
    
    #pragma region Windows Form Designer generated code
    		/// <summary>
    		/// Erforderliche Methode für die Designerunterstützung.
    		/// Der Inhalt der Methode darf nicht mit dem Code-Editor geändert werden.
    		/// </summary>
    		void InitializeComponent(void)
    		{
    			this->label1 = (gcnew System::Windows::Forms::Label());
    			this->folderBrowserDialog1 = (gcnew System::Windows::Forms::FolderBrowserDialog());
    			this->groupBox1 = (gcnew System::Windows::Forms::GroupBox());
    			this->radioButton4 = (gcnew System::Windows::Forms::RadioButton());
    			this->radioButton3 = (gcnew System::Windows::Forms::RadioButton());
    			this->radioButton2 = (gcnew System::Windows::Forms::RadioButton());
    			this->radioButton1 = (gcnew System::Windows::Forms::RadioButton());
    			this->label2 = (gcnew System::Windows::Forms::Label());
    			this->checkBox1 = (gcnew System::Windows::Forms::CheckBox());
    			this->checkBox2 = (gcnew System::Windows::Forms::CheckBox());
    			this->checkBox3 = (gcnew System::Windows::Forms::CheckBox());
    			this->button1 = (gcnew System::Windows::Forms::Button());
    			this->button2 = (gcnew System::Windows::Forms::Button());
    			this->button3 = (gcnew System::Windows::Forms::Button());
    			this->button4 = (gcnew System::Windows::Forms::Button());
    			this->button5 = (gcnew System::Windows::Forms::Button());
    			this->textBox1 = (gcnew System::Windows::Forms::TextBox());
    			this->textBox2 = (gcnew System::Windows::Forms::TextBox());
    			this->textBox3 = (gcnew System::Windows::Forms::TextBox());
    			this->folderBrowserDialog2 = (gcnew System::Windows::Forms::FolderBrowserDialog());
    			this->label3 = (gcnew System::Windows::Forms::Label());
    			this->label4 = (gcnew System::Windows::Forms::Label());
    			this->groupBox1->SuspendLayout();
    			this->SuspendLayout();
    			// 
    			// label1
    			// 
    			this->label1->AutoSize = true;
    			this->label1->BackColor = System::Drawing::Color::White;
    			this->label1->Font = (gcnew System::Drawing::Font(L"Courier New", 18, System::Drawing::FontStyle::Bold, System::Drawing::GraphicsUnit::Point, 
    				static_cast<System::Byte>(0)));
    			this->label1->ForeColor = System::Drawing::Color::Gray;
    			this->label1->Location = System::Drawing::Point(113, 9);
    			this->label1->Name = L"label1";
    			this->label1->Size = System::Drawing::Size(180, 27);
    			this->label1->TabIndex = 0;
    			this->label1->Text = L"Sort-Machine";
                                                    // 
    			// folderBrowserDialog1
    			// 
    			this->folderBrowserDialog1->RootFolder = System::Environment::SpecialFolder::MyComputer;
    			// 
    			// groupBox1
    			// 
    			this->groupBox1->Controls->Add(this->radioButton4);
    			this->groupBox1->Controls->Add(this->radioButton3);
    			this->groupBox1->Controls->Add(this->radioButton2);
    			this->groupBox1->Controls->Add(this->radioButton1);
    			this->groupBox1->Location = System::Drawing::Point(21, 61);
    			this->groupBox1->Name = L"groupBox1";
    			this->groupBox1->Size = System::Drawing::Size(200, 114);
    			this->groupBox1->TabIndex = 1;
    			this->groupBox1->TabStop = false;
    			this->groupBox1->Text = L"Sortieren nach";
    			// 
    			// radioButton4
    			// 
    			this->radioButton4->AutoSize = true;
    			this->radioButton4->Location = System::Drawing::Point(8, 89);
    			this->radioButton4->Name = L"radioButton4";
    			this->radioButton4->Size = System::Drawing::Size(89, 17);
    			this->radioButton4->TabIndex = 3;
    			this->radioButton4->TabStop = true;
    			this->radioButton4->Text = L"... Dateigröße";
    			this->radioButton4->UseVisualStyleBackColor = true;
    			this->radioButton4->CheckedChanged += gcnew System::EventHandler(this, &Form1::rb4_checkedChanged);
    			// 
    			// radioButton3
    			// 
    			this->radioButton3->AutoSize = true;
    			this->radioButton3->Location = System::Drawing::Point(8, 66);
    			this->radioButton3->Name = L"radioButton3";
    			this->radioButton3->Size = System::Drawing::Size(190, 17);
    			this->radioButton3->TabIndex = 2;
    			this->radioButton3->TabStop = true;
    			this->radioButton3->Text = L"... Anfangsbuchstaben und -zahlen";
    			this->radioButton3->UseVisualStyleBackColor = true;
    			this->radioButton3->CheckedChanged += gcnew System::EventHandler(this, &Form1::rb3_CheckedChanged);
    			// 
    			// radioButton2
    			// 
    			this->radioButton2->AutoSize = true;
    			this->radioButton2->Location = System::Drawing::Point(8, 43);
    			this->radioButton2->Name = L"radioButton2";
    			this->radioButton2->Size = System::Drawing::Size(98, 17);
    			this->radioButton2->TabIndex = 1;
    			this->radioButton2->TabStop = true;
    			this->radioButton2->Text = L"... Dateiendung";
    			this->radioButton2->UseVisualStyleBackColor = true;
    			this->radioButton2->CheckedChanged += gcnew System::EventHandler(this, &Form1::rb2_CheckedChanged);
    			// 
    			// radioButton1
    			// 
    			this->radioButton1->AutoSize = true;
    			this->radioButton1->Location = System::Drawing::Point(8, 20);
    			this->radioButton1->Name = L"radioButton1";
    			this->radioButton1->Size = System::Drawing::Size(117, 17);
    			this->radioButton1->TabIndex = 0;
    			this->radioButton1->TabStop = true;
    			this->radioButton1->Text = L"... Erstellungsdatum";
    			this->radioButton1->UseVisualStyleBackColor = true;
    			this->radioButton1->CheckedChanged += gcnew System::EventHandler(this, &Form1::rb1_CheckedChanged);
    			// 
    			// label2
    			// 
    			this->label2->AutoSize = true;
    			this->label2->Location = System::Drawing::Point(243, 61);
    			this->label2->Name = L"label2";
    			this->label2->Size = System::Drawing::Size(69, 13);
    			this->label2->TabIndex = 2;
    			this->label2->Text = L"Separieren in";
    			// 
    			// checkBox1
    			// 
    			this->checkBox1->AutoSize = true;
    			this->checkBox1->Location = System::Drawing::Point(246, 82);
    			this->checkBox1->Name = L"checkBox1";
    			this->checkBox1->Size = System::Drawing::Size(70, 17);
    			this->checkBox1->TabIndex = 3;
    			this->checkBox1->Text = L"... Jahren";
    			this->checkBox1->UseVisualStyleBackColor = true;
    			this->checkBox1->CheckedChanged += gcnew System::EventHandler(this, &Form1::cb_CheckedChanged);
    Es geht weiter im nächstem Post.

  • #2
    Programm zum Sortieren

    Code:
    // 
    			// button2
    			// 
    			this->button2->Location = System::Drawing::Point(147, 203);
    			this->button2->Name = L"button2";
    			this->button2->Size = System::Drawing::Size(101, 22);
    			this->button2->TabIndex = 7;
    			this->button2->Text = L"Zielverzeichnis";
    			this->button2->UseVisualStyleBackColor = true;
    			this->button2->Click += gcnew System::EventHandler(this, &Form1::b2_Click);
    			// 
    			// button3
    			// 
    			this->button3->Location = System::Drawing::Point(294, 199);
    			this->button3->Name = L"button3";
    			this->button3->Size = System::Drawing::Size(101, 31);
    			this->button3->TabIndex = 8;
    			this->button3->Text = L"Sortieren!";
    			this->button3->UseVisualStyleBackColor = true;
    			this->button3->Click += gcnew System::EventHandler(this, &Form1::b3_Click);
    			// 
    			// button4
    			// 
    			this->button4->Location = System::Drawing::Point(12, 9);
    			this->button4->Name = L"button4";
    			this->button4->Size = System::Drawing::Size(62, 22);
    			this->button4->TabIndex = 9;
    			this->button4->Text = L"Über";
    			this->button4->UseVisualStyleBackColor = true;
    			this->button4->Click += gcnew System::EventHandler(this, &Form1::b4_Click);
    			// 
    			// button5
    			// 
    			this->button5->Location = System::Drawing::Point(333, 9);
    			this->button5->Name = L"button5";
    			this->button5->Size = System::Drawing::Size(62, 22);
    			this->button5->TabIndex = 10;
    			this->button5->Text = L"Schließen";
    			this->button5->UseVisualStyleBackColor = true;
    			this->button5->Click += gcnew System::EventHandler(this, &Form1::b5_Click);
    			// 
    			// textBox1
    			// 
    			this->textBox1->Location = System::Drawing::Point(266, 79);
    			this->textBox1->Name = L"textBox1";
    			this->textBox1->Size = System::Drawing::Size(129, 20);
    			this->textBox1->TabIndex = 11;
    			this->textBox1->TextChanged += gcnew System::EventHandler(this, &Form1::tb1_TextChanged);
    			// 
    			// textBox2
    			// 
    			this->textBox2->Location = System::Drawing::Point(266, 124);
    			this->textBox2->Name = L"textBox2";
    			this->textBox2->Size = System::Drawing::Size(129, 20);
    			this->textBox2->TabIndex = 13;
    			this->textBox2->TextChanged += gcnew System::EventHandler(this, &Form1::tb2_TextChanged);
    			// 
    			// textBox3
    			// 
    			this->textBox3->Location = System::Drawing::Point(266, 102);
    			this->textBox3->Name = L"textBox3";
    			this->textBox3->Size = System::Drawing::Size(129, 20);
    			this->textBox3->TabIndex = 12;
    			this->textBox3->TextChanged += gcnew System::EventHandler(this, &Form1::tb3_TextChanged);
    			// 
    			// folderBrowserDialog2
    			// 
    			this->folderBrowserDialog2->RootFolder = System::Environment::SpecialFolder::MyComputer;
    			// 
    			// label3
    			// 
    			this->label3->AutoSize = true;
    			this->label3->Location = System::Drawing::Point(13, 185);
    			this->label3->Name = L"label3";
    			this->label3->Size = System::Drawing::Size(35, 13);
    			this->label3->TabIndex = 14;
    			this->label3->Text = L"label3";
    			// 
    			// label4
    			// 
    			this->label4->AutoSize = true;
    			this->label4->Location = System::Drawing::Point(13, 233);
    			this->label4->Name = L"label4";
    			this->label4->Size = System::Drawing::Size(35, 13);
    			this->label4->TabIndex = 15;
    			this->label4->Text = L"label4";
    			// 
    			// Form1
    			// 
    			this->AutoScaleDimensions = System::Drawing::SizeF(6, 13);
    			this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font;
    			this->BackColor = System::Drawing::Color::Silver;
    			this->ClientSize = System::Drawing::Size(407, 252);
    			this->Controls->Add(this->label4);
    			this->Controls->Add(this->label3);
    			this->Controls->Add(this->textBox3);
    			this->Controls->Add(this->textBox2);
    			this->Controls->Add(this->textBox1);
    			this->Controls->Add(this->button5);
    			this->Controls->Add(this->button4);
    			this->Controls->Add(this->button3);
    			this->Controls->Add(this->button2);
    			this->Controls->Add(this->button1);
    			this->Controls->Add(this->checkBox3);
    			this->Controls->Add(this->checkBox2);
    			this->Controls->Add(this->checkBox1);
    			this->Controls->Add(this->label2);
    			this->Controls->Add(this->groupBox1);
    			this->Controls->Add(this->label1);
    			this->FormBorderStyle = System::Windows::Forms::FormBorderStyle::None;
    			this->MaximizeBox = false;
    			this->MinimizeBox = false;
    			this->Name = L"Form1";
    			this->ShowInTaskbar = false;
    			this->StartPosition = System::Windows::Forms::FormStartPosition::CenterScreen;
    			this->Text = L"Sort-Machine";
    			this->groupBox1->ResumeLayout(false);
    			this->groupBox1->PerformLayout();
    			this->ResumeLayout(false);
    			this->PerformLayout();
    
    		}
    #pragma endregion
    private: System::Void rb1_CheckedChanged(System::Object^  sender, System::EventArgs^  e) {
    			 this->textBox1->Hide();
    			 this->textBox2->Hide();
    			 this->textBox3->Hide();
    			 this->checkBox1->Text = "... Jahren";
    			 this->checkBox1->Enabled = true;
    			 this->checkBox2->Text = "... Monaten";
    			 this->checkBox2->Enabled = true;
    			 this->checkBox3->Text = "... Tagen";
    			 this->checkBox3->Enabled = true;
    			 this->checkBox1->Checked = false;
    			 this->checkBox2->Checked = false;
    			 this->checkBox3->Checked = false;			 
    		 }
    private: System::Void rb2_CheckedChanged(System::Object^  sender, System::EventArgs^  e) {
    			 this->textBox1->Show();
    			 this->textBox2->Show();
    			 this->textBox3->Show();
    			 this->textBox1->Text = "Beispiel : .txt";
    			 this->textBox2->Text = "";
    			 this->textBox3->Text = "";
    			 this->checkBox1->Checked = false;
    			 this->checkBox2->Checked = false;
    			 this->checkBox3->Checked = false;
    			 this->checkBox1->Enabled = true;
    			 this->checkBox2->Enabled = true;
    			 this->checkBox3->Enabled = true;			 
    		 }
    private: System::Void rb3_CheckedChanged(System::Object^  sender, System::EventArgs^  e) {
    			 this->textBox1->Hide();
    			 this->textBox2->Hide();
    			 this->textBox3->Hide();
    			 this->checkBox1->Enabled = false;
    			 this->checkBox2->Enabled = false;
    			 this->checkBox3->Enabled = false;
    			 this->checkBox1->Text = "";
    			 this->checkBox2->Text = "";
    			 this->checkBox3->Text = "";
    			 if(this->radioButton3->Checked == true)
    				 this->button1->Enabled = true;
    			 else
    				 this->button1->Enabled = false;
    			 
    		 }
    private: System::Void rb4_checkedChanged(System::Object^  sender, System::EventArgs^  e) {
    			 this->textBox1->Show();
    			 this->textBox2->Show();
    			 this->textBox3->Show();
    			 this->textBox1->Text = "Beispiel (in KB!): <1200";
    			 this->textBox2->Text = "";
    			 this->textBox3->Text = "";
    			 this->checkBox1->Checked = false;
    			 this->checkBox2->Checked = false;
    			 this->checkBox3->Checked = false;
    			 this->checkBox1->Enabled = true;
    			 this->checkBox2->Enabled = true;
    			 this->checkBox3->Enabled = true;
    		 }
    private: System::Void b5_Click(System::Object^  sender, System::EventArgs^  e) {
    			 this->Close();
    		 }
    private: System::Void tb1_Click(System::Object^  sender, System::EventArgs^  e) {
    			 this->textBox1->Text = "";
    		 }
    private: System::Void b4_Click(System::Object^  sender, System::EventArgs^  e) {
    			 MessageBox::Show("Entwickler : Felix Schaumann", "Über");
    		 }
    private: System::Void b1_Click(System::Object^  sender, System::EventArgs^  e) {
    			 this->folderBrowserDialog1->ShowDialog();
    			 if(this->folderBrowserDialog1->SelectedPath != "")
    				 this->button2->Enabled = true;
    			 this->label3->Text = "Suche : " + this->folderBrowserDialog1->SelectedPath;
    		 }
    private: System::Void b2_Click(System::Object^  sender, System::EventArgs^  e) {
    			 this->folderBrowserDialog2->ShowDialog();
    			 if(this->folderBrowserDialog2->SelectedPath != "")
    				 this->button3->Enabled = true;
    			 this->label4->Text = "Ziel     : " + this->folderBrowserDialog2->SelectedPath;
    		 }

    Comment


    • #3
      Programm zum Sortieren

      Code:
      private: System::Void cb_CheckedChanged(System::Object^  sender, System::EventArgs^  e) {
      			 if(this->checkBox1->Checked == true || this->checkBox2->Checked == true || this->checkBox3->Checked == true)
      				 this->button1->Enabled = true;
      			 else{
      				 this->button1->Enabled = false;
      				 this->button2->Enabled = false;
      				 this->button3->Enabled = false;
      			 }
      		 }
      
      		 Void datum(bool jahr, bool monat, bool tag, String ^s_ordner, String ^z_ordner){
      			 array<String^> ^files = System::IO::Directory::GetFiles(s_ordner);
      			 for each(String ^file in files){
      				 System::IO::FileInfo ^fi = gcnew System::IO::FileInfo(file);
      
      				 if(jahr == true && monat == true && tag == true){
      					 if(!System::IO::Directory::Exists(System::String::Concat(z_ordner, "\\", "Jahr-", fi->CreationTime.Year.ToString(), "\\", "Monat-", fi->CreationTime.Month.ToString(), "\\", "Tag-", fi->CreationTime.Day.ToString())))
      						 System::IO::Directory::CreateDirectory(System::String::Concat(z_ordner, "\\", "Jahr-", fi->CreationTime.Year.ToString(), "\\", "Monat-", fi->CreationTime.Month.ToString(), "\\", "Tag-", fi->CreationTime.Day.ToString()));
      					 System::IO::File::Copy(file, System::String::Concat(z_ordner, "\\", "Jahr-", fi->CreationTime.Year.ToString(), "\\", "Monat-", fi->CreationTime.Month.ToString(), "\\", "Tag-", fi->CreationTime.Day.ToString(), "\\", fi->Name));
      				 }
      				 else if(jahr == true && monat == true){
      					 if(!System::IO::Directory::Exists(System::String::Concat(z_ordner, "\\", "Jahr-", fi->CreationTime.Year.ToString(), "\\", "Monat-", fi->CreationTime.Month.ToString())))
      						 System::IO::Directory::CreateDirectory(System::String::Concat(z_ordner, "\\", "Jahr-", fi->CreationTime.Year.ToString(), "\\", "Monat-", fi->CreationTime.Month.ToString()));
      					 System::IO::File::Copy(file, System::String::Concat(z_ordner, "\\", "Jahr-", fi->CreationTime.Year.ToString(), "\\", "Monat-", fi->CreationTime.Month.ToString(), "\\", fi->Name));
      				 }
      				 else if(jahr == true && tag == true){
      					 if(!System::IO::Directory::Exists(System::String::Concat(z_ordner, "\\", "Jahr-", fi->CreationTime.Year.ToString(), "\\", "Tag-", fi->CreationTime.Day.ToString())))
      						 System::IO::Directory::CreateDirectory(System::String::Concat(z_ordner, "\\", "Jahr-", fi->CreationTime.Year.ToString(), "\\", "Tag-", fi->CreationTime.Day.ToString()));
      					 System::IO::File::Copy(file, System::String::Concat(z_ordner, "\\", "Jahr-", fi->CreationTime.Year.ToString(), "\\", "Tag-", fi->CreationTime.Day.ToString(), "\\", fi->Name));
      				 }
      				 else if(monat == true && tag == true){
      					 if(!System::IO::Directory::Exists(System::String::Concat(z_ordner, "\\", "Monat-", fi->CreationTime.Month.ToString(), "\\", "Tag-", fi->CreationTime.Day.ToString())))
      						 System::IO::Directory::CreateDirectory(System::String::Concat(z_ordner, "\\", "Monat-", fi->CreationTime.Month.ToString(), "\\", "Tag-", fi->CreationTime.Day.ToString()));
      					 System::IO::File::Copy(file, System::String::Concat(z_ordner, "\\", "Monat-", fi->CreationTime.Month.ToString(), "\\", "Tag-", fi->CreationTime.Day.ToString(), "\\", fi->Name));
      				 }
      				 else if(jahr == true){
      					 if(!System::IO::Directory::Exists(System::String::Concat(z_ordner, "\\", "Jahr-", fi->CreationTime.Year.ToString())))
      						 System::IO::Directory::CreateDirectory(System::String::Concat(z_ordner, "\\", "Jahr-", fi->CreationTime.Year.ToString()));
      					 System::IO::File::Copy(file, System::String::Concat(z_ordner, "\\", "Jahr-", fi->CreationTime.Year.ToString(), "\\", fi->Name));
      				 }
      				 else if(monat == true){
      					 if(!System::IO::Directory::Exists(System::String::Concat(z_ordner, "\\", "Monat-", fi->CreationTime.Month.ToString())))
      						 System::IO::Directory::CreateDirectory(System::String::Concat(z_ordner, "\\", "Monat-", fi->CreationTime.Month.ToString()));
      					 System::IO::File::Copy(file, System::String::Concat(z_ordner, "\\", "Monat-", fi->CreationTime.Month.ToString(), "\\", fi->Name));
      				 }
      				 else{
      					 if(!System::IO::Directory::Exists(System::String::Concat(z_ordner, "\\", "Tag-", fi->CreationTime.Day.ToString())))
      						 System::IO::Directory::CreateDirectory(System::String::Concat(z_ordner, "\\", "Tag-", fi->CreationTime.Day.ToString()));
      					 System::IO::File::Copy(file, System::String::Concat(z_ordner, "\\", "Tag-", fi->CreationTime.Day.ToString(), "\\", fi->Name));
      				 }
      			 }
      		 }
      
      		 Void ende(String ^s_end, String ^s_ordner, String ^z_ordner){
      			 array<String^> ^files = System::IO::Directory::GetFiles(s_ordner);
      			 String ^end;
      			 for each(String ^file in files){
      				 System::IO::FileInfo ^fs = gcnew System::IO::FileInfo(file);
      				 end = fs->Extension;
      				 if(end == s_end){
      					 if(!System::IO::Directory::Exists(System::String::Concat(z_ordner, "\\Dateiendung-", fs->Extension)))
      						 System::IO::Directory::CreateDirectory(System::String::Concat(z_ordner, "\\Dateiendung-", fs->Extension));
      					 System::IO::File::Copy(file, System::String::Concat(z_ordner, "\\", "Dateiendung-", fs->Extension, "\\", fs->Name));
      				 }
      			 }
      		 }
      
      		 Void gro(Int64 kb, bool kleiner){
      			 
      			 if(kleiner == true){
      				 String ^s_ordner = this->folderBrowserDialog1->SelectedPath;
      				 String ^z_ordner = this->folderBrowserDialog2->SelectedPath;
      				 array<String^> ^files = System::IO::Directory::GetFiles(s_ordner);
      				 for each(String ^file in files){
      					 System::IO::FileInfo ^fs = gcnew System::IO::FileInfo(file);
      					 Int64 gro = fs->Length;
      					 if(gro < kb){
      						 if(!System::IO::Directory::Exists(System::String::Concat(z_ordner, "\\Dateigröße-bis_", kb/1000, "KB")))
      							 System::IO::Directory::CreateDirectory(System::String::Concat(z_ordner, "\\Dateigröße-bis_", kb/1000, "KB"));
      						 System::IO::File::Copy(file, System::String::Concat(z_ordner, "\\Dateigröße-bis_", kb/1000, "KB", "\\", fs->Name));
      					 }
      				 }
      			 }
      			 else{
      				 String ^s_ordner = this->folderBrowserDialog1->SelectedPath;
      				 String ^z_ordner = this->folderBrowserDialog2->SelectedPath;
      				 array<String^> ^files = System::IO::Directory::GetFiles(s_ordner);
      				 for each(String ^file in files){
      					 System::IO::FileInfo ^fs = gcnew System::IO::FileInfo(file);
      					 Int64 gro = fs->Length;
      					 if(gro > kb){
      						 if(!System::IO::Directory::Exists(System::String::Concat(z_ordner, "\\Dateigröße-über_", kb/1000, "KB")))
      							 System::IO::Directory::CreateDirectory(System::String::Concat(z_ordner, "\\Dateigröße-über_", kb/1000, "KB"));
      						 System::IO::File::Copy(file, System::String::Concat(z_ordner, "\\Dateigröße-über_", kb/1000, "KB", "\\", fs->Name));
      					 }
      				 }
      			 }
      		 }

      Comment


      • #4
        Code:
        private: System::Void b3_Click(System::Object^  sender, System::EventArgs^  e) {
        			 this->button1->Enabled = false;
        			 this->button2->Enabled = false;
        			 this->button3->Enabled = false;
        			 if(this->radioButton1->Checked == true){
        				 if(this->checkBox1->Checked == true && this->checkBox2->Checked == true && this->checkBox3->Checked == true)
        					 datum(true, true, true, this->folderBrowserDialog1->SelectedPath, this->folderBrowserDialog2->SelectedPath);
        				 else if(this->checkBox1->Checked == true && this->checkBox2->Checked == true)
        					 datum(true, true, false, this->folderBrowserDialog1->SelectedPath, this->folderBrowserDialog2->SelectedPath);
        				 else if(this->checkBox1->Checked == true && this->checkBox3->Checked == true)
        					 datum(true, false, true, this->folderBrowserDialog1->SelectedPath, this->folderBrowserDialog2->SelectedPath);
        				 else if(this->checkBox2->Checked == true && this->checkBox3->Checked == true)
        					 datum(false, true, true, this->folderBrowserDialog1->SelectedPath, this->folderBrowserDialog2->SelectedPath);
        				 else if(this->checkBox1->Checked == true)
        					 datum(true, false, false, this->folderBrowserDialog1->SelectedPath, this->folderBrowserDialog2->SelectedPath);
        				 else if(this->checkBox2->Checked == true)
        					 datum(false, true, false, this->folderBrowserDialog1->SelectedPath, this->folderBrowserDialog2->SelectedPath);
        				 else
        					 datum(false, false, true, this->folderBrowserDialog1->SelectedPath, this->folderBrowserDialog2->SelectedPath);
        			 }
        			 else if(this->radioButton2->Checked == true){
        				 if(this->checkBox1->Checked == true)
        					 ende(this->textBox1->Text, this->folderBrowserDialog1->SelectedPath, this->folderBrowserDialog2->SelectedPath);
        				 if(this->checkBox2->Checked == true)
        					 ende(this->textBox2->Text, this->folderBrowserDialog1->SelectedPath, this->folderBrowserDialog2->SelectedPath);
        				 if(this->checkBox3->Checked == true)
        					 ende(this->textBox3->Text, this->folderBrowserDialog1->SelectedPath, this->folderBrowserDialog2->SelectedPath);
        			 }
        			 else if(this->radioButton3->Checked == true){
        				 String ^s_ordner = this->folderBrowserDialog1->SelectedPath;
        				 String ^z_ordner = this->folderBrowserDialog2->SelectedPath;
        				 String ^name;
        				 array<String^> ^files = System::IO::Directory::GetFiles(s_ordner);
        				 for each(String ^file in files){
        					 System::IO::FileInfo ^fs = gcnew System::IO::FileInfo(file);
        					 name = fs->Name->ToUpper();
        					 array<wchar_t> ^c = name->ToCharArray();
        					 if(!System::IO::Directory::Exists(System::String::Concat(z_ordner, "\\", c[0])))
        						 System::IO::Directory::CreateDirectory(System::String::Concat(z_ordner, "\\", c[0]));
        					 System::IO::File::Copy(file, System::String::Concat(z_ordner, "\\", c[0], "\\", fs->Name));
        				 }
        				 this->button1->Enabled = true;
        			 }
        			 else{
        				 if(this->checkBox1->Checked == true){
        					 array<wchar_t> ^c = this->textBox1->Text->ToCharArray();
        					 if(c[0] == '<')
        						 gro(Convert::ToInt32(System::String::Concat(this->textBox1->Text->Substring(1, this->textBox1->Text->Length-1), "000")), true);
        					 else
        						 gro(Convert::ToInt32(System::String::Concat(this->textBox1->Text->Substring(1, this->textBox1->Text->Length-1), "000")), false);
        				 }
        				 if(this->checkBox2->Checked == true){
        					 array<wchar_t> ^c = this->textBox3->Text->ToCharArray();
        					 if(c[0] == '<')
        						 gro(Convert::ToInt32(System::String::Concat(this->textBox3->Text->Substring(1, this->textBox3->Text->Length-1), "000")), true);
        					 else
        						 gro(Convert::ToInt32(System::String::Concat(this->textBox3->Text->Substring(1, this->textBox3->Text->Length-1), "000")), false);
        				 }
        				 if(this->checkBox3->Checked == true){
        					 array<wchar_t> ^c = this->textBox2->Text->ToCharArray();
        					 if(c[0] == '<')
        						 gro(Convert::ToInt32(System::String::Concat(this->textBox2->Text->Substring(1, this->textBox2->Text->Length-1), "000")), true);
        					 else
        						 gro(Convert::ToInt32(System::String::Concat(this->textBox2->Text->Substring(1, this->textBox2->Text->Length-1), "000")), false);
        				 }
        			 }
        			 this->checkBox1->Checked = false;
        			 this->checkBox2->Checked = false;
        			 this->checkBox3->Checked = false;
        			 this->label3->Text = "Suche : ";
        			 this->label4->Text = "Ziel     : ";
        		 }
        private: System::Void tb1_TextChanged(System::Object^  sender, System::EventArgs^  e) {
        			 if(this->textBox1->Text != "")
        				 this->checkBox1->Checked = true;
        			 else
        				 this->checkBox1->Checked = false;
        		 }
        
        private: System::Void tb3_TextChanged(System::Object^  sender, System::EventArgs^  e) {
        			 if(this->textBox3->Text != "")
        				 this->checkBox2->Checked = true;
        			 else
        				 this->checkBox2->Checked = false;
        		 }
        private: System::Void tb2_TextChanged(System::Object^  sender, System::EventArgs^  e) {
        			 if(this->textBox2->Text != "")
        				 this->checkBox3->Checked = true;
        			 else
        				 this->checkBox3->Checked = false;
        		 }
        };
        }
        Das war's.

        MfG,

        die_enwickler idee .

        Comment


        • #5
          Hier könnt ihr euch das Programm kompiliert + Quelltext herunterladen :
          Und was macht es dann für einen Sinn, hier über 4 Beiträge Quelltext zu posten?
          Christian

          Comment


          • #6
            Ich dachte, da vielleicht nicht jeder Lust hat das zu downloaden, nur um den Quelltext zu sehen. So kann man ihn wenigstens kurz überfliegen.

            Aber wenn das sinnlos ist, werde ich diese entfernen.

            Comment

            Working...
            X