Modifying input file extra data RRS feed

  • Question

  • Hi,

    I have a input file name as 'ChangesetDetails.txt'. Basically this file contains list of file names. I will have to loop through each line from this file (file names) and look in some other location if this file is being modified (this logic is already in place.) If the file is modified, I have to update the input file as 'ChangesetDetails_Output.txt' and enter few details like who modified and time. For example:

    If  'ChangesetDetails.txt' file is like this:




    If DEF.dll is modified, then 'ChangesetDetails_Output.txt' should look like this:



    Modified time

    Modified by


    So basically 'ChangesetDetails_Output.txt' should contain the existing data along with modified data.

    Please let me know better logic to do this.

    Kindly waiting for your response.



    Sunday, June 14, 2020 2:32 PM

All replies

  • This seems like a very easy exercise.  What do you already have?

    Tim Roberts | Driver MVP Emeritus | Providenza & Boekelheide, Inc.

    Monday, June 15, 2020 1:26 AM
  • I have looking in some other location if this file is being modified. What I am looking for is loop through each line from the file and update the input file if the file names is modified.

    Kindly let me know the solution.



    Monday, June 15, 2020 4:09 AM
  • Hi Santosh PU,

    Thank you for posting here.

    The modification time could be get by File.GetLastWriteTime(String) Method, it seems that we cannot know who modified this file.

    For documents with the suffix docs, xlsx, ppt and other formats, it will have the "Last Saved By" property, but for a dll file, it does not have such a property.

    Best Regards,


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Monday, June 15, 2020 9:10 AM
  • Getting the modification time is easy.  Despite what Timon says, File.GetLastWriteTime works just fine on DLLs.

    The first problem with your example is, modified since when?  Let's say you read the first line, ABC.dll.  Let's say it was last modified yesterday.  Unless there is a time already in the file, how will you know whether it needs to be written?  I think on the first pass through the file, you'll need to write a "Modified time" line for every file.  After that, you can read the last modification time and decide if it has been modified since.  It would be easier if you had all of the information on one line, like a comma-separated file:

        ABC.dll,2020/06/23 12:34:56,joe

    I'm not sure what you mean by "modified by".  There's no way in Windows to tell who modified a file.

    Tim Roberts | Driver MVP Emeritus | Providenza & Boekelheide, Inc.

    • Proposed as answer by Naomi N Monday, June 15, 2020 9:45 PM
    Monday, June 15, 2020 9:39 PM