源安全子文件夹

时间:2016-08-03 10:43:15

标签: c# visual-sourcesafe-2005

如何使用c#代码获取所有源安全子文件夹? 我们也希望获得子文件夹中的所有子文件夹和文件夹。 例如,TestProject有2个文件夹,文件夹a和b。和一个子文件夹a1。

提取所有路径: 1.测试项目 - >一个 2. TestProject - > a - > A1 3. TestProject - > B'/ P>

2 个答案:

答案 0 :(得分:0)

如果要列出仅包含文件的所有子目录,则可以使用此

new Vue({
        el:"#userslist",
        ready:function(){   

            this.fetchUsers();
            this.fetchRoles();
        },
        data:{
            selected : '',
            users : "",
            allRoles : "",
        },
        methods:{                               
            fetchUsers:function(){
                this.$http.get('{{route('get.all.users')}}').then(
                    (response) => {
                        console.log(response);

                        this.$set('users',response.data);
                        // success callback
                    }, 
                    (response) => {
                        // error callback
                    }
                );
            },
            fetchRoles:function(){
                this.$http.get('{{route('get.all.roles')}}').then(
                    (response) => {
                        this.$set('allRoles',response.data);
                        $('.select2').select2();                
                    }, 
                    (response) => {

                    }
                );
            },              
        }
    });

但是如果你只想要解析所有的目录&子目录 然后你可以使用这个

   Public static IEnumerable<string>   GetSubdirectoriesContainingOnlyFiles(string path)
         {
             return from subdirectory in Directory.GetDirectories(path, "*", SearchOption.AllDirectories)
                    where Directory.GetDirectories(subdirectory).Length == 0
                    select subdirectory;
        }

答案 1 :(得分:0)

我的工作就像这样

using System;
using System.Collections.ObjectModel;
using Microsoft.TeamFoundation.Client;
using Microsoft.TeamFoundation.VersionControl.Client;

using System.IO;

namespace TFS_Path_Extraction
{
    class Program
    {
        static void Main(string[] args)
        {
            TeamFoundationServer server = new TeamFoundationServer("<TFS path of folders you want>");
            VersionControlServer version = server.GetService(typeof(VersionControlServer)) as VersionControlServer;

            ItemSet items = version.GetItems(@"$\", RecursionType.Full);
            foreach (Item item in items.Items)
            {
                if (item.ItemType == ItemType.Folder)
                {
                    System.Console.WriteLine(item.ServerItem);
                }
            }
            Console.Read();
        }
    }
}
相关问题