Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/vb.net/14.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/visual-studio/8.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何计算vb.net文件夹中的文件夹数_Vb.net_Visual Studio_Visual Studio 2010_Directory - Fatal编程技术网

如何计算vb.net文件夹中的文件夹数

如何计算vb.net文件夹中的文件夹数,vb.net,visual-studio,visual-studio-2010,directory,Vb.net,Visual Studio,Visual Studio 2010,Directory,我想能够将有多少文件夹在一个文件夹。这是因为我要做一个备份系统,我想能够说,如果已经有5个文件夹在文件夹中,然后删除最旧的,并添加一个新的。我该怎么做?首先,您可以使用该方法获得所有子目录的集合。找出该集合中存在多少项应该很简单 如果您需要搜索最旧的一个,那么对上一个API调用中的每个项使用该方法。返回的FileInfo对象将包含创建时间和其他信息。希望这有帮助 我算出来了 Dim counter As _ System.Collections.ObjectModel.ReadOnlyColl

我想能够将有多少文件夹在一个文件夹。这是因为我要做一个备份系统,我想能够说,如果已经有5个文件夹在文件夹中,然后删除最旧的,并添加一个新的。我该怎么做?

首先,您可以使用该方法获得所有子目录的集合。找出该集合中存在多少项应该很简单

如果您需要搜索最旧的一个,那么对上一个API调用中的每个项使用该方法。返回的FileInfo对象将包含创建时间和其他信息。希望这有帮助

我算出来了

Dim counter As  _
System.Collections.ObjectModel.ReadOnlyCollection(Of String)
        counter = My.Computer.FileSystem.GetDirectories("C:\test")
        MsgBox("number of folders is " & CStr(counter.Count))
我刚得到一个文件,并对它做了一点修改:)。。。。现在来制定日期系统