I need to lock a Directory in Windows OSes,(Win 7,Win8 & Recent Server Editions), such that the lock will prevent any Modifications/Rename/Delete for the files recursively inside that directory.

I have a written a Client that download files from my File Server, with resume capability. For ex, consider the following Directory tree,

  • PAR_DIR_0
  • [INDENT]SUB_DIR_LEV_1_001 [ CONTAINS 10 K Files ]
  • [INDENT]
    SUB_DIR_LEV_2_001 [ CONTAINS 10 K Files]
  • FILE_UNDER_PAR_001



When my Client starts downloading files from the server one by one, lets say the User Renames the Directory 'SUB_DIR_LEV_1_001' to 'SUB_DIR_LEV_1_001_RENAMED', when only 5K Files are downloaded, then SUB_DIR_LEV_1_001 contains 5k Files and 'SUB_DIR_LEV_1_001_RENAMED' contains 5K Files. Thing is user don't know that Client hasn't downloaded all files for the directory ''SUB_DIR_LEV_1_001'. So i want to lock the entire directory 'PAR_DIR_0', so that no files/folder under it can be modified by the user, except by my Client Process until download completes. Another thing to note , My Client is running under 'Same User' whom i want to prevent changing the Directory contents.