取得工作目录下的文件

  //取得工作目录下的文件
        public static ArrayList ListFiles(string strFolderEntry)
        {
            ArrayList objFileList = new ArrayList();
            ListFilesFormFolder(strFolderEntry, ref objFileList);
            return objFileList;
        }

        private static void ListFilesFormFolder(string strFolderEntry, ref ArrayList objFileList)
        {
            foreach (string strFile in Directory.GetFiles(strFolderEntry))
            {
                if (!objFileList.Contains(strFile))
                {
                    objFileList.Add(strFile);
                }
            }

            foreach (string strFolder in Directory.GetDirectories(strFolderEntry))
            {
                ListFilesFormFolder(strFolder, ref objFileList);
            }
        }

posted on 2008-04-21 16:19  噢耶游戏  阅读(269)  评论(0编辑  收藏  举报