Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Do buttona:
- string katalog_skad_przenosic = @".\SkyGfx_SA_patch\SkyGfx_SA_4.1";
- string katalog_do_usuniecia = @".\SkyGfx_SA_patch";
- string katalog_o_dwa_nizej = @".\"; //czyli tam gdzie .exe
- foreach (string dir in Directory.GetDirectories(katalog_skad_przenosic, "*", SearchOption.AllDirectories))
- {
- Directory.CreateDirectory(Path.Combine(katalog_o_dwa_nizej, dir.Substring(katalog_skad_przenosic.Length + 1)));
- }
- foreach (string file_name in Directory.GetFiles(katalog_skad_przenosic, "*", SearchOption.AllDirectories))
- {
- Directory.Move(file_name, Path.Combine(katalog_o_dwa_nizej, file_name.Substring(katalog_skad_przenosic.Length + 1)));
- }
- Wait(3000); // Użycie: 3000ms = 3s
- // Po 3 sekundach usuwa folder
- Directory.Delete(katalog_do_usuniecia, true);
- // Nad buttonem, wywołujący powyższy kod dodaj:
- public void Wait(int time)
- {
- System.Threading.Thread thread = new System.Threading.Thread(delegate ()
- {
- System.Threading.Thread.Sleep(time);
- });
- thread.Start();
- while (thread.IsAlive)
- Application.DoEvents();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement