0

Well I am stuck with this, and I have a few questions:

  1. How will you check whether the folder has been modified without touching the files? "Last Modified" changes when a file is created/deleted, when a subfolder is created/deleted, but doesn't change when a file is modified (For example, when its size changes).

  2. If a file size changes then folder size will also vary, but there is no API to find the folder size in Windows without touching the file.

    Say I give some values to every folder, now when its size changes will that value change by default? (An expected example may be, its hash value?) or what will change by default in windows when a folder is modified? (Other than its size.)

Thanks in advance.

Unihedron
  • 10,902
  • 13
  • 62
  • 72
  • 1
    I don't know what you're really asking ,but you might want to take alook at "Change Journals in Windows". It's pretty complicated but that's the only 100% reliable way of detecting changes in the filesystem.http://www.microsoft.com/msj/1099/journal2/journal2.aspx – engf-010 Jul 31 '14 at 09:08
  • and http://www.microsoft.com/msj/0999/journal/journal.aspx – engf-010 Jul 31 '14 at 09:11
  • Please show what you have tried (As you have mentioned you were stuck) for us to troubleshoot. Other than that, the limits are pretty arbitrary and doesn't seem like a good question to me. – Unihedron Jul 31 '14 at 09:19
  • Iam developing an app which scans Directorys and returns Directory statistics ... for the first i scan the entire directory and i store the info into a database.. for the subsequent scans i would like to scan only the folders which have changed .. i would like to use the info of the remaining Folders from the dB... – Bharath Ragu Jul 31 '14 at 09:26
  • @user3781814: You really ,really need Change Journals. You may find you don't need a database (since it's already there) and they are really fast (much faster than scanning folders and files). – engf-010 Jul 31 '14 at 09:30
  • thanks Edwin.. i wil take a look at it .... – Bharath Ragu Jul 31 '14 at 09:34
  • @user3781814: Good luck and remember it's rather complicated so it will take some time to 'master' it. – engf-010 Jul 31 '14 at 09:35
  • Your comments indicate that you believe folders have properties of themselves, which in reality are only derived properties. E.g. folders don't have a size. The combined files in a folder do. The difference is relevant because hardlinks invalidate some of your assumptions. E.g. deleting a "100 MB folder" may not free 100 MB of diskspace. Famous example: SxS folder on Windows. – MSalters Jul 31 '14 at 11:42
  • @Edwin:So how to retrieve the Path of a file with Parent referenece Number without using Findfirst and FindNext Function ? – Bharath Ragu Aug 13 '14 at 07:31

1 Answers1

2

If you want to monitor a folder for changes, you can use the api ReadDirectoryChangesW. However, if you want to check it offline then you would need to scan the complete directory & check each file modified date, folder creation date etc. Compare it with the last scan time.

You can stop scanning whenever you find at least one change to save time when scanning.

If your app has administrator's rights then you can find changes in a folder by reading the NTFS change journal.

Community
  • 1
  • 1
Gautam Jain
  • 6,789
  • 10
  • 48
  • 67
  • @user3781814 Please then specify more clearly what you need, otherwise your question would become opinionated. – Unihedron Jul 31 '14 at 09:05
  • Well i dont want continuous montoring .. and i should'nt access Files separately.. just access folders While Scanning and should be able to Find the folders that have Changed .. – Bharath Ragu Jul 31 '14 at 09:09