Register Register Member Login Member Login Member Login Forgot Password ??
PHP , ASP , ASP.NET, VB.NET, C#, Java , jQuery , Android , iOS , Windows Phone
 

Registered : 109,027

HOME > .NET Framework > Forum > อยากเขียนโปรแกรม Backup ข้อมูลจาก Folder หนึ่ง ไปยังอีก Folder หนึ่ง จะเริ่มยังไงดีค่ะ



 

อยากเขียนโปรแกรม Backup ข้อมูลจาก Folder หนึ่ง ไปยังอีก Folder หนึ่ง จะเริ่มยังไงดีค่ะ

 



Topic : 049045

Guest




อยากเขียนโปรแกรม Backup ข้อมูลจาก Folder หนึ่ง ไปยังอีก Folder หนึ่ง โดยการตั้งเวลา copy Folder จะเริ่มยังไงดีค่ะ



Tag : .NET, C#, VS 2008 (.NET 3.x)







Move To Hilight (Stock) 
Send To Friend.Bookmark.
Date : 2010-09-20 14:00:35 By : 025 View : 1909 Reply : 3
 

 

No. 1



โพสกระทู้ ( 538 )
บทความ ( 3 )

สมาชิกที่ใส่เสื้อไทยครีเอท

สถานะออฟไลน์


เริ่มจากหาแนวคิดก่อนครับ ว่าอยากจะ backup แบบไหนเวลาไหน ถ้าเป็นแค่ไฟล์ อาจจะไม่ต้องเขียนโปรแกรมเลยก็ได้ครับ ทำแค่ batch script ที่มีอยู่แล้วใน windows ก็ได้แล้ว เรื่องการตั้งเวลา windows ก็มี scheduled task ไว้ให้ใช้

หาแนวคิด

เก็บจากไหน ไปไหน
เก็บแบบไหน zip??
แยกประเภท หรือวันเวลาที่จะทำไม๊
ต้องการ log ไว้ดูหรือเปล่า??

และอย่างที่บอกถ้าเ็ป็นแค่ file ข้อมูล ไม่ใช่ database หรือ backup อะไรที่ซับซ้อนกว่าการ copy move delete ของเก่า ไม่ต้องเขียนโปรแกรมเลย






แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2010-09-20 14:13:32 By : salapao_codeman
 


 

No. 2

Guest


ถ้าจะ ทำ backup แบบzipfile ด้วยจะเขียนcode vb2008 ยังไงครับ แนะนำหน่อยครับ
แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2011-06-27 10:43:58 By : Guest
 

 

No. 3



โพสกระทู้ ( 249 )
บทความ ( 0 )



สถานะออฟไลน์
Facebook

Code (C#)
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.IO;
using System.IO.Compression;
using System.Windows.Forms;

namespace Zipping
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void btnBrowse_Click(object sender, EventArgs e)
        {
            // Show the dialog where the user chooses the file to compress 
            if (openFile.ShowDialog() == DialogResult.OK)
            {
                txtPath.Text = openFile.FileName;
            }
        }

        private void btnCompress_Click(object sender, EventArgs e)
        {
// If the user has selected a path where to put the compressed file
if (saveFile.ShowDialog() == DialogResult.OK)
{
    // Bytes array in which we're going to store the actual file to be compressed
    byte[] bufferWrite;
    // Will open the file to be compressed
    FileStream fsSource;
    // Will write the new zip file
    FileStream fsDest;
    GZipStream gzCompressed;
    fsSource = new FileStream(txtPath.Text, FileMode.Open, FileAccess.Read, FileShare.Read);
    // Set the buffer size to the size of the file
    bufferWrite = new byte[fsSource.Length];
    // Read the data from the stream into the buffer
    fsSource.Read(bufferWrite, 0, bufferWrite.Length);
    // Open the FileStream to write to
    fsDest = new FileStream(saveFile.FileName, FileMode.OpenOrCreate, FileAccess.Write);

    // Will hold the compressed stream created from the destination stream
    gzCompressed = new GZipStream(fsDest, CompressionMode.Compress, true);

    // Write the compressed stream from the bytes array to a file
    gzCompressed.Write(bufferWrite, 0, bufferWrite.Length);

    // Close the streams
    fsSource.Close();
    gzCompressed.Close();
    fsDest.Close();
}
        }
    }
}

แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2011-06-27 15:47:26 By : tee
 

   

ค้นหาข้อมูล


   
 

แสดงความคิดเห็น
Re : อยากเขียนโปรแกรม Backup ข้อมูลจาก Folder หนึ่ง ไปยังอีก Folder หนึ่ง จะเริ่มยังไงดีค่ะ
 
 
รายละเอียด
 
ตัวหนา ตัวเอียง ตัวขีดเส้นใต้ ตัวมีขีดกลาง| ตัวเรืองแสง ตัวมีเงา ตัวอักษรวิ่ง| จัดย่อหน้าอิสระ จัดย่อหน้าชิดซ้าย จัดย่อหน้ากึ่งกลาง จัดย่อหน้าชิดขวา| เส้นขวาง| ขนาดตัวอักษร แบบตัวอักษร
ใส่แฟลช ใส่รูป ใส่ไฮเปอร์ลิ้งค์ ใส่อีเมล์ ใส่ลิ้งค์ FTP| ใส่แถวของตาราง ใส่คอลัมน์ตาราง| ตัวยก ตัวห้อย ตัวพิมพ์ดีด| ใส่โค้ด ใส่การอ้างถึงคำพูด| ใส่ลีสต์
smiley for :lol: smiley for :ken: smiley for :D smiley for :) smiley for ;) smiley for :eek: smiley for :geek: smiley for :roll: smiley for :erm: smiley for :cool: smiley for :blank: smiley for :idea: smiley for :ehh: smiley for :aargh: smiley for :evil:
Insert PHP Code
Insert ASP Code
Insert VB.NET Code Insert C#.NET Code Insert JavaScript Code Insert C#.NET Code
Insert Java Code
Insert Android Code
Insert Objective-C Code
Insert XML Code
Insert SQL Code
Insert Code
เพื่อความเรียบร้อยของข้อความ ควรจัดรูปแบบให้พอดีกับขนาดของหน้าจอ เพื่อง่ายต่อการอ่านและสบายตา และตรวจสอบภาษาไทยให้ถูกต้อง

อัพโหลดแทรกรูปภาพ

Notice

เพื่อความปลอดภัยของเว็บบอร์ด ไม่อนุญาติให้แทรก แท็ก [img]....[/img] โดยการอัพโหลดไฟล์รูปจากที่อื่น เช่นเว็บไซต์ ฟรีอัพโหลดต่าง ๆ
อัพโหลดแทรกรูปภาพ ให้ใช้บริการอัพโหลดไฟล์ของไทยครีเอท และตัดรูปภาพให้พอดีกับสกรีน เพื่อความโหลดเร็วและไฟล์ไม่ถูกลบทิ้ง

   
  เพื่อความปลอดภัยและการตรวจสอบ กระทู้ที่แทรกไฟล์อัพโหลดไฟล์จากที่อื่น อาจจะถูกลบทิ้ง
 
โดย
อีเมล์
บวกค่าให้ถูก
<= ตัวเลขฮินดูอารบิก เช่น 123 (หรือล็อกอินเข้าระบบสมาชิกเพื่อไม่ต้องกรอก)







Exchange: นำเข้าสินค้าจากจีน, Taobao, เฟอร์นิเจอร์, ของพรีเมี่ยม, ร่ม, ปากกา, power bank, แฟลชไดร์ฟ, กระบอกน้ำ

Load balance : Server 03
ThaiCreate.Com Logo
© www.ThaiCreate.Com. 2003-2024 All Rights Reserved.
ไทยครีเอทบริการ จัดทำดูแลแก้ไข Web Application ทุกรูปแบบ (PHP, .Net Application, VB.Net, C#)
[Conditions Privacy Statement] ติดต่อโฆษณา 081-987-6107 อัตราราคา คลิกที่นี่