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,038

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


 

[.NET] อยากเขียนโปรแกรม 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 : 2061 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#)
01.using System;
02.using System.Collections.Generic;
03.using System.ComponentModel;
04.using System.Data;
05.using System.Drawing;
06.using System.Text;
07.using System.IO;
08.using System.IO.Compression;
09.using System.Windows.Forms;
10. 
11.namespace Zipping
12.{
13.    public partial class Form1 : Form
14.    {
15.        public Form1()
16.        {
17.            InitializeComponent();
18.        }
19. 
20.        private void btnBrowse_Click(object sender, EventArgs e)
21.        {
22.            // Show the dialog where the user chooses the file to compress
23.            if (openFile.ShowDialog() == DialogResult.OK)
24.            {
25.                txtPath.Text = openFile.FileName;
26.            }
27.        }
28. 
29.        private void btnCompress_Click(object sender, EventArgs e)
30.        {
31.// If the user has selected a path where to put the compressed file
32.if (saveFile.ShowDialog() == DialogResult.OK)
33.{
34.    // Bytes array in which we're going to store the actual file to be compressed
35.    byte[] bufferWrite;
36.    // Will open the file to be compressed
37.    FileStream fsSource;
38.    // Will write the new zip file
39.    FileStream fsDest;
40.    GZipStream gzCompressed;
41.    fsSource = new FileStream(txtPath.Text, FileMode.Open, FileAccess.Read, FileShare.Read);
42.    // Set the buffer size to the size of the file
43.    bufferWrite = new byte[fsSource.Length];
44.    // Read the data from the stream into the buffer
45.    fsSource.Read(bufferWrite, 0, bufferWrite.Length);
46.    // Open the FileStream to write to
47.    fsDest = new FileStream(saveFile.FileName, FileMode.OpenOrCreate, FileAccess.Write);
48. 
49.    // Will hold the compressed stream created from the destination stream
50.    gzCompressed = new GZipStream(fsDest, CompressionMode.Compress, true);
51. 
52.    // Write the compressed stream from the bytes array to a file
53.    gzCompressed.Write(bufferWrite, 0, bufferWrite.Length);
54. 
55.    // Close the streams
56.    fsSource.Close();
57.    gzCompressed.Close();
58.    fsDest.Close();
59.}
60.        }
61.    }
62.}

แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
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 (หรือล็อกอินเข้าระบบสมาชิกเพื่อไม่ต้องกรอก)





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