Results 1 to 2 of 2

Thread: Read only Dir

  1. #1

    Thread Starter
    Frenzied Member Technocrat's Avatar
    Join Date
    Jan 2000
    Location
    I live in the 1s and 0s of everyones data streams
    Posts
    1,024

    Read only Dir

    When I do the following it does not finding readonly Dirs.
    Also the date created seems to be 1 day off.

    Any idea why?

    I have XP and MSVC 7

    PHP Code:
    hFind FindFirstFile(sBuffer.c_str(), &DataFind);
        while(
    hFind != INVALID_HANDLE_VALUE && bMoreFiles )
        {
            if(
    DataFind.dwFileAttributes FILE_ATTRIBUTE_DIRECTORY && 
                (
    strcmp(DataFind.cFileName".") != 0) && (strcmp(DataFind.cFileName"..") != 0))
            {
                
    sTemp DataFind.cFileName;
                
    s_Temp.sDirName sTemp;
                
    FileTime DataFind.ftCreationTime;
                
    FileTimeToSystemTime(&FileTime,&s_Temp.sDateCreated);   // <<------- Off By 1 Day
                
    if(DataFind.dwFileAttributes FILE_ATTRIBUTE_ARCHIVE)
                    
    s_Temp.bArchive TRUE;
                if(
    DataFind.dwFileAttributes FILE_ATTRIBUTE_HIDDEN)
                    
    s_Temp.bHidden TRUE;
                if(
    DataFind.dwFileAttributes FILE_ATTRIBUTE_READONLY)   // <<---------- Not working
                    
    s_Temp.bReadOnly TRUE;
            }
            
    bMoreFiles FindNextFile(hFind, &DataFind);
        } 
    MSVS 6, .NET & .NET 2003 Pro
    I HATE MSDN with .NET & .NET 2003!!!

    Check out my sites:
    http://www.filthyhands.com
    http://www.techno-coding.com


  2. #2
    Frenzied Member
    Join Date
    Jul 2002
    Posts
    1,370
    Filetimes have to converted to Localtime to be correct -
    use FileTimeToLocalTime() because the date you see is a UTC value, not when the file was actually created locally.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width