Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6581643
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T16:10:46+00:00 2026-05-25T16:10:46+00:00

Am I doing this right? I am trying to find all the changes that

  • 0

Am I doing this right?

I am trying to find all the changes that took place in a folder called C:\Perl

After ReadDirectoryChangesW, it just gets stuck there. It doesn’t move forward. Am I missing something obvious?

I am trying to achieve: How can I detect only deleted, changed, and created files on a volume?

Once everyday, I want to run the backup program, which will backup only the files that were changed under a specific folder.

int _tmain(int argc, _TCHAR* argv[])
{
TCHAR szBuffer[640] = {0};  
DWORD dwOffset = 0;
FILE_NOTIFY_INFORMATION* pInfo = NULL;
DWORD dwBytes;
HANDLE hFolder = CreateFile(L"C:\\Perl", FILE_LIST_DIRECTORY, FILE_SHARE_READ|FILE_SHARE_DELETE, NULL, OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS, NULL);
cout<<"Hello"<<endl;
ReadDirectoryChangesW(hFolder, szBuffer, sizeof(szBuffer) / sizeof(TCHAR), FALSE, FILE_NOTIFY_CHANGE_FILE_NAME, &dwBytes, NULL, NULL);
cout<<"Done"<<endl;
do
{
    // Get a pointer to the first change record...
    pInfo = (FILE_NOTIFY_INFORMATION*) &szBuffer[dwOffset];

    // ReadDirectoryChangesW processes filenames in Unicode. We will convert them to a TCHAR format...
    TCHAR szFileName[MAX_PATH] = {0};

    wcout<<pInfo->FileName<<"\t"<<pInfo->Action ;
    //WideCharToMultiByte(CP_ACP, NULL, pInfo->FileName, pInfo->FileNameLength, szFileName, sizeof(szFileName) / sizeof(TCHAR), NULL, NULL);

    // Perform your tests here...
    if (pInfo->Action == FILE_ACTION_ADDED)
    {
    }

    // More than one change may happen at the same time. Load the next change and continue...
    dwOffset += pInfo->NextEntryOffset;
}
while (pInfo->NextEntryOffset != 0);

}

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T16:10:47+00:00Added an answer on May 25, 2026 at 4:10 pm

    You are calling it in synchronous mode, so it’s not returning until there’s a change to report. This is by design.

    The Remarks section in the documentation explains how to call it asynchronously.

    It sounds like what you want is to see if something changed since some point in time. If so, this is not the API you’re looking for. You could iterate the contents and check the creation and modification timestamps on each file. If you want to notice deletions, you’ll have to keep track of what you found last time and check to see if it’s still there this time.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Im not sure if I'm doing this right. I have an action that I
This is doing my head right in! I am messing about with JRuby trying
Right now I'm doing this: SELECT * FROM messages WHERE location_id = 7 AND
Right now I'm doing something like this: RewriteRule ^/?logout(/)?$ logout.php RewriteRule ^/?config(/)?$ config.php I
I'm currently doing something like this in some code I'm working on right now:
What is the most efficient way to do this? Right now I am doing
I have some code doing this : var changes = document.getElementsByName(from); for (var c=0;
I'm probably doing this all wrong. I have a text file full of data
I can't seem to figure out what I'm doing wrong... I'm trying to find
I'm sure there's a really easy way of doing this. I'm trying to take

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.