Folge dem Video um zu sehen, wie unsere Website als Web-App auf dem Startbildschirm installiert werden kann.
Anmerkung: Diese Funktion ist in einigen Browsern möglicherweise nicht verfügbar.
using System.IO;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.IO;
private void button1_Click(object sender, EventArgs e)
{
// Datumholen und Ordnernamen schreiben
DateTime newDate = new DateTime();
newDate = DateTime.Now;
uname = newDate.Year + "_" + newDate.Month + "_" + newDate.Day;
oname = "Sicherung - USB";
// Unterverzeichnis erzeugen
Directory.CreateDirectory(oname);
DirectoryInfo uord = new DirectoryInfo((path2 + Convert.ToString("\\") + oname));
uord.Create();
DirectoryInfo ud = uord.CreateSubdirectory(uname);
newpath = path2 + Convert.ToString("\\") + oname + Convert.ToString("\\") + uname;
FileSystem.CopyDirectory.CopyDirectory(path1, newpath);
}
private static void CopyFolder(string sourceFolder, string targetFolder)
{
// Verzeichnis am Zielort erstellen
Directory.CreateDirectory(targetFolder);
// Alle Dateien kopieren
string[] files = Directory.GetFiles(sourceFolder);
foreach (string file in files)
{
string target = Path.Combine(targetFolder, Path.GetFileName(file));
File.Copy(file, target, true);
}
// Alle Unterverzeichnisse kopieren
string[] subSourceFolders = Directory.GetDirectories(sourceFolder);
foreach (string subSourceFolder in subSourceFolders)
{
string subTargetFolder = subSourceFolder.Replace(sourceFolder, targetFolder);
CopyFolder(subSourceFolder, subTargetFolder);
}
}
Microsoft.VisualBasic.FileIO.FileSystem.CopyDirectory(olddir, newdir);
using Microsoft.VisualBasic.FileIO ;
...
FileSystem.CopyDirectory(olddir, newdir);