public static bool CopyDir(string sPath, string dPath)
{
try
{
DirectoryInfo spdi = new DirectoryInfo(sPath);
spdi.Attributes &= ~FileAttributes.ReadOnly;
foreach (string dirPath in Directory.GetDirectories(sPath, "*",
SearchOption.AllDirectories))
Directory.CreateDirectory(dirPath);
foreach (string newPath in Directory.GetFiles(dPath, "*.*",
SearchOption.AllDirectories))
{
File.SetAttributes(dPath, FileAttributes.Normal);
File.Copy(sPath, newPath);
}
Directory.CreateDirectory(dPath);
return true;
}
catch (UnauthorizedAccessException e)
{
MessageBox.Show("Attempt to copy failed. (UAC) Raw: "+e,"IO Error",MessageBoxButtons.OK, MessageBoxIcon.Error);
return false;
}
}
答案 0 :(得分:0)
var input_data = [
{'row0':
[
{'color':'danger','item1':'value1','item2':'value2','item3':'value3'},
{'color':'active','item4':'value4','item5':'value5','item6':'value6'}
]},
{'row1':
[{'color':'danger','item7':'value7','item8':'value8','item9':'value9'},
{'color':'active','item10':'value10','item11':'value11','item12':'value12'}
]}
];
现在你可以在input_data.length上尝试lopping并使用它。