复制 移动 与获取文件属性



CopyFile
BOOL WINAPI CopyFile(
  _In_  LPCTSTR lpExistingFileName,
  _In_  LPCTSTR lpNewFileName,
  _In_  BOOL bFailIfExists
);


MoveFile
BOOL WINAPI MoveFile(
  __in  LPCTSTR lpExistingFileName,
  __in  LPCTSTR lpNewFileName
);


获得文件属性:


UpdateData(TRUE);
CFileStatus rStatus;
if(CFile::GetStatus(m_strFile,rStatus))
{
m_strSize.Format("%d字节",rStatus.m_size);
m_strCTime = rStatus.m_ctime.Format("%Y年%m月%d日 %H:%M:%S");
m_strMTime = rStatus.m_mtime.Format("%Y年%m月%d日 %H:%M:%S");
m_strATime = rStatus.m_atime.Format("%Y年%m月%d日 %H:%M:%S");
//判断是否只读
if((rStatus.m_attribute & 0x01) == 0x01)
m_bReadOnly = TRUE;
else
m_bReadOnly = FALSE;
//判断是否隐藏
if((rStatus.m_attribute & 0x02) == 0x02)
m_bHidden = TRUE;
else
m_bHidden = FALSE;
//判断是否存档
if((rStatus.m_attribute & 0x20) == 0x20)
m_bArchive = TRUE;
else
m_bArchive = FALSE;
//判断是否是系统文件
if((rStatus.m_attribute & 0x04) == 0x04)
m_bSystem = TRUE;
else
m_bSystem = FALSE;
UpdateData(FALSE);
}

你可能感兴趣的:(复制 移动 与获取文件属性)