Results 1 to 8 of 8

Thread: Modify Properties Of Text File

  1. #1

    Thread Starter
    New Member
    Join Date
    May 2011
    Posts
    3

    Question Modify Properties Of Text File

    I have the same problem with fileName.txt and fileName.dat.

    did you get any relevant unswer??
    did you find any solution for this problem?





    Quote Originally Posted by Shaitan00 View Post
    Goal:
    Given a Text File “Test.dat”, I need to retrieve the date on which the file was last Modified & Copied to a specific location,

    Problem:
    The file can be transferred (copied) via any method to the specific location and must retain the required information however protocols like FTP change/destroy the original Created/Modified/Accessed date thus rendering them useless.

    Possible Solution:
    Use one of the other fields (in Summary for example: Keywords or Comments) to store the Timestamp prior to copy, this way windows should not be able to destroy the information. Please confirm.

    Create a new field (in Summary for example) to store the timestamp. Please confirm.

    Given these requirements, if it is even possible, how could I write/read from the File Information, like the File Summary Properties for example?

  2. #2
    C# Aficionado Lord_Rat's Avatar
    Join Date
    Sep 2001
    Location
    Cave
    Posts
    2,497

    Re: Access/Modify File Info/Properties of a Text File [C#]

    See the answer with the green checkmark here:
    http://stackoverflow.com/questions/5...ile-properties
    Need to re-register ASP.NET?
    C:\WINNT\Microsoft.NET\Framework\v#VERSIONNUMBER#\aspnet_regiis -i

    (Edit #VERSIONNUMBER# as needed - do a DIR if you don't know)

  3. #3

    Thread Starter
    New Member
    Join Date
    May 2011
    Posts
    3

    Re: Access/Modify File Info/Properties of a Text File [C#]

    Thanks,

    It was very useful with c#.

    I guss, because the dll was written in c++, it has to be easier to use it in c++, am i right?? (Please confirm)

    Can you please tell me how can i do the same in c++??

    (Code example wiil be received with pleasure )

  4. #4
    Addicted Member BSA01's Avatar
    Join Date
    Apr 2009
    Location
    Bosnia and Herzegovina
    Posts
    146

    Re: Access/Modify File Info/Properties of a Text File [C#]

    With this code, you can access more than 255 properties of any file

    Code:
    Shell32.Shell shell = new Shell32.Shell();
                Shell32.Folder objFolder;
    
                objFolder = shell.NameSpace(Path.GetDirectoryName(FilePath));
                
                foreach (Shell32.FolderItem2 item in objFolder.Items())
                    if (item.Name == Name + "." + FileFormat)
                    {
                        Length = objFolder.GetDetailsOf(item, 27);
                        Height = objFolder.GetDetailsOf(item, 280);
                        Width = objFolder.GetDetailsOf(item, 282);
                    }
    BOLD is what I used in one app to retrive video info, the numbers 27,280,282 are Property ID, you can go through this with debugger and you will find property and it's ID.

  5. #5

    Thread Starter
    New Member
    Join Date
    May 2011
    Posts
    3

    Re: Access/Modify File Info/Properties of a Text File [C#]

    first of all, thank you!

    how can i do it with c++ ? - by using shell32.dll...

    can you give me a code example in c++??

  6. #6
    Addicted Member BSA01's Avatar
    Join Date
    Apr 2009
    Location
    Bosnia and Herzegovina
    Posts
    146

    Re: Access/Modify File Info/Properties of a Text File [C#]

    Quote Originally Posted by newdeveloper View Post
    first of all, thank you!

    how can i do it with c++ ? - by using shell32.dll...

    can you give me a code example in c++??
    I am sorry, I am not familiar with c++

  7. #7
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: Modify Properties Of Text File

    Split from a 6 year old thread into its own thread and moved to C++

  8. #8
    Raging swede Atheist's Avatar
    Join Date
    Aug 2005
    Location
    Sweden
    Posts
    8,018

    Re: Modify Properties Of Text File

    Could you explain exactly what it is you want? Reading the post you've quoted, it sounds like the OP wanted to create some sort of extra field in a file to store the last-modified date. Is this what you want to do?
    Rate posts that helped you. I do not reply to PM's with coding questions.
    How to Get Your Questions Answered
    Current project: tunaOS
    Me on.. BitBucket, Google Code, Github (pretty empty)

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