#ifndef _CFINDFILE_H_ #define _CFINDFILE_H_ #ifdef _WINDOWS64 #ifdef PUB_TOOLS_EXPORTS #define PUB_TOOLS_API __declspec(dllexport) #else #define PUB_TOOLS_API __declspec(dllimport) #endif #else #define PUB_TOOLS_API #endif #include #include #include #include #include #include #include #ifndef _WINDOWS64 #include #include #include #include #include #include #include #include #else #include #include #include #include #endif using namespace std; #define MAXNAMLENGTH 256 #ifndef _WINDOWS64 class CFindFile { public: CFindFile(); ~CFindFile(); private: ///enum {MAXNAMLEN = 256}; char m_chPath[MAXNAMLENGTH]; char m_chName[MAXNAMLENGTH]; DIR *m_pDir; dirent *m_pDirent; bool IsSpecialType(int nType) const; public: char *GetFileName() ; bool IsDirectory() const; bool IsFifo() const; bool IsChar() const; bool IsBlock() const; bool IsLink() const; bool IsSocket() const; bool IsNormal() const; void OwnerMode(bool &bRead,bool &bWrite,bool &bExec); void GroupMode(bool &bRead,bool &bWrite,bool &bExec); void OtherMode(bool &bRead,bool &bWrite,bool &bExec); bool GetLastModifyTime(int &sec); int chrcnt(const char *string,int letter); public: bool FindFile(char *pPath); int FindNext(); int RmOldFile(char* pPath , int cur_sec , int time_interval); bool GetFindFileName(string &filename); bool GetFindFileName(const string strPathName , vector &filenameVec , int nFileNum); bool GetCurFileName(string & filename) ; int CheckPath(string strPathname); bool CheckDirSizeOutOfMaxSize(string strPathName , int nMaxSize); int RemoveDir(string strPathName); //zhangkeheng add for REP bool GetFindFileNameByAlphaSort(string &filename); bool GetFindFileNameByAlphaSort(const string strPathName , vector &filenameVec , int nFileNum); bool GetFindFileNameByAlphaSort1(string &filename , int & count); //zhangkeheng add for 时序相关 bool GetRep1FileCountByAlphaSort(string &filename , int & rep1_count, const int max_count); //chenpeng add for 复制服务分目录 bool GetFindDirNameByAlphaSort(const string strPathName , vector &dirnameVec , int nDirNum); bool GetFindDirNameByAlphaSort(const string strPathName , string &dirname ,bool need_check = true); int GetFindFileNameByAlphaSort(const string strPathName , vector &filenameVec , string &dirname,int nFileNum , bool need_check = true); bool GetFindDirNameByAlphaSort1(string &dirname , int & count); }; #else class PUB_TOOLS_API CFindFile { public: CFindFile(); ~CFindFile(); public: int CheckPath(string strPathname); //zhangkeheng add for REP bool GetFindFileNameByAlphaSort(string &filename); bool GetFindFileNameByAlphaSort(const string strPathName, vector &filenameVec , int nFileNum); bool GetFindFileNameByAlphaSort1(string &filename , int & count); //zhangkeheng add for 时序相关 bool GetRep1FileCountByAlphaSort(string &filename , int & rep1_count, const int max_count); //chenpeng add for 复制服务分目录 bool GetFindDirNameByAlphaSort(const string strPathName , string &dirname ,bool need_check = true); int GetFindFileNameByAlphaSort(const string strPathName , vector &filenameVec , string &dirname,int nFileNum , bool need_check = true); bool GetFindDirNameByAlphaSort1(string &dirname , int & count); }; #endif #endif