ちょっとしたアプリを作ってみました,パソコン間でデータを移行するものです
市販のソフトだとファイヤーウオールを止めたリしなければなりませんライセンスがいります簡易アプリを作ってみましたwindowsではデフォルトでネットワークからpcにアクセスできます自宅のプライベートネットワークで、パソコンのログインしているユーザとパスワードがわかれば、任意のパソコンからアクセス可能です。共有名「Users」でパソコンユーザのフォルダーが共有になっていますこの共有をネットワークドライブに割り当てれば、エクスプローラで操作が可能になります操作内容 ネットワークドライブ接続 コピーフォルダー選択 コピーにはrobocopyを使いますこれらは手作業でできるのですが、プログラムで簡単に行えるようにしましたC#のアプリです頭の体操になりました下記に保存してありますhttp://clinic.mond.jp/appl/pcmove.zipMove.exe データ移行サポートツールMyIP.bat 転送先で実行し、自分のIPアドレスと名前を表示pct_free_easeus.exe ツールRobocopy.exe ツール searchIP.ps1 転送元で実行、ネットワーク内のデバイスを調べるパソコン引っ越しのために.docx データ移行のための情報をまとめていますusing System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Linq;using System.Text;using System.Threading.Tasks;using System.Windows.Forms;using System.IO;using System.Diagnostics;using System.Net;namespace Move{ public partial class Form1 : Form { String desktop; String document; String picture; String video; String music; Boolean networkDrive; public Form1() { InitializeComponent(); networkDrive = false; } private void Form1_Load(object sender, EventArgs e) { desktop = System.Environment.GetFolderPath(System.Environment.SpecialFolder.DesktopDirectory); document = System.Environment.GetFolderPath(System.Environment.SpecialFolder.MyDocuments); picture = System.Environment.GetFolderPath(System.Environment.SpecialFolder.MyPictures); video = System.Environment.GetFolderPath(System.Environment.SpecialFolder.MyVideos); music = System.Environment.GetFolderPath(System.Environment.SpecialFolder.MyMusic); getIPaddress(); driveletter.Items.Add("X:"); driveletter.Items.Add("Y:"); driveletter.Items.Add("Z:"); driveletter.Text = "X:"; GetDrive(); ToFolder.Text = "backup"; } private void GetDrive() { string[] drives = Directory.GetLogicalDrives(); string w = ""; int n; n = 1; ToDrive.Items.Clear(); foreach (string drive in drives) { if (drive != "C:\\") { if (n == 1) { w = drive; n = 0; } ToDrive.Items.Add(drive); } } ToDrive.Text = w; } private void backup_Click(object sender, EventArgs e) { if (checkBox1.Checked == true) { copyto("desktop"); } if (checkBox2.Checked == true) { copyto("music"); } if (checkBox3.Checked == true) { copyto("video"); } if (checkBox4.Checked == true) { copyto("picture"); } if (checkBox5.Checked == true) { copyto("document"); } if (checkBox6.Checked == true) { copytoOutlook(); } if (sfolder.Text != "") { copyfolder(); } } private void copyfolder() { String w; String target; String cmd; w = sfolder.Text; string[] arr = w.Split('\\'); ProcessStartInfo pInfo = new ProcessStartInfo(); target = ToDrive.Text + ToFolder.Text + "\\" + arr[arr.Length - 1]; cmd = " /S /E " + w + " " + target; pInfo.FileName = "robocopy"; Process.Start("robocopy", cmd); } private void copytoOutlook() { String w; String target; String cmd; w = " \"" + document + "\\" + "Outlook ファイル" + "\""; ProcessStartInfo pInfo = new ProcessStartInfo(); target = ToDrive.Text + ToFolder.Text + "\\" + "outlook"; cmd = " /S /E " + w + " " + target; pInfo.FileName = "robocopy"; Process.Start("robocopy", cmd); } private void copyto(string w) { String to; String source; String target; String cmd; to = ""; if (w == "desktop") { to = desktop; } if (w == "document") { to = document; } if (w == "picture") { to = picture; } if (w == "video") { to = video; } if (w == "music") { to = music; } source = to; target = ToDrive.Text + ToFolder.Text + "\\" + w; ProcessStartInfo pInfo = new ProcessStartInfo(); cmd = " /R:1 /W:1 /S /E " + source + " " + target; pInfo.FileName = "robocopy"; Process.Start("robocopy", cmd); } private void end_Click(object sender, EventArgs e) { if(networkDrive) { ProcessStartInfo pInfo = new ProcessStartInfo(); string cmd = " use " + driveletter.Text +" /delete"; pInfo.FileName = "net"; Process.Start("net", cmd); } Application.Exit(); } private void folderSelect() { FolderBrowserDialog fbDialog = new FolderBrowserDialog(); fbDialog.Description = "移行するフォルダーを選んでください"; fbDialog.SelectedPath = @"C:"; fbDialog.ShowNewFolderButton = true; if (fbDialog.ShowDialog() == DialogResult.OK) { sfolder.Text=fbDialog.SelectedPath; } else { //Console.WriteLine("キャンセルされました"); } // オブジェクトを破棄する fbDialog.Dispose(); } private void button1_Click(object sender, EventArgs e) { folderSelect(); } private void getIPaddress() { string w; String sep; string hostname = Dns.GetHostName(); IPAddress[] adrList = Dns.GetHostAddresses(hostname); foreach (IPAddress address in adrList) { w="."+address.ToString(); if (w.IndexOf("192.168.")>0) { string[] arr = w.Split('.'); ip3.Text = arr[1]+"."+arr[2]+"."+arr[3]+"."; } } } private void button2_Click(object sender, EventArgs e) { if (ip.Text == "") { return; } if (userid.Text == "") { return; } if (pswd.Text == "") { return; } if (driveletter.Text == "") { return; } ProcessStartInfo pInfo = new ProcessStartInfo(); string cmd = " use " +driveletter.Text+" \\\\"+ip3.Text+ip.Text+"\\users\\"+userid.Text+" "+pswd.Text+ " /user:"+userid.Text ; pInfo.FileName = "net"; Process.Start("net", cmd); ToDrive.Text = driveletter.Text+"\\"; networkDrive = true; } private void driveletter_SelectedIndexChanged(object sender, EventArgs e) { GetDrive(); } }}