Getting File Properties info

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • sudhivns
    New Member
    • Nov 2007
    • 52

    Getting File Properties info

    Hi,

    is there any API for
    I have file in system stored as C:\TEMP\TEST.DA TA.
    Need to get the exact name (as store in system including case sensitive), suppose if i pass file name as c:\temp\test.da ta or handle to that file.

    Basically wanted to retrieve the file name as stored in system rather than if user specifies c:\temp\test.da ta (as user can give in any format).

    Bye
  • gpraghuram
    Recognized Expert Top Contributor
    • Mar 2007
    • 1275

    #2
    Originally posted by sudhivns
    Hi,

    is there any API for
    I have file in system stored as C:\TEMP\TEST.DA TA.
    Need to get the exact name (as store in system including case sensitive), suppose if i pass file name as c:\temp\test.da ta or handle to that file.

    Basically wanted to retrieve the file name as stored in system rather than if user specifies c:\temp\test.da ta (as user can give in any format).

    Bye
    R u trying this on windows?
    Because windows 98 and previous versions has this behaviour(.i am not very sure about it)
    And that too only for files more than 8 characters in length.

    Raghuram

    Comment

    • sudhivns
      New Member
      • Nov 2007
      • 52

      #3
      My requirement goes something like this.
      if user enters (in UI) c:\temp\test.tx t , but actually system storage is as c:\TEMP\TEST.TX T(observe case sensitive). Here my application takes the backup of this file and there is finally facility to restore the same file.
      So on restore, i wanted to create folder c:\TEMP(case sensitive) and TEST.TXT in that folder.

      SO during backup statge i want to use c:\TEMP\TEST.TX T (rather than c:\temp\test.tx t user entered in UI . here issue is case sensitive and i want to extract the file property as defined on the system). Hope my requirement is clear now.

      Comment

      • gpraghuram
        Recognized Expert Top Contributor
        • Mar 2007
        • 1275

        #4
        Originally posted by sudhivns
        My requirement goes something like this.
        if user enters (in UI) c:\temp\test.tx t , but actually system storage is as c:\TEMP\TEST.TX T(observe case sensitive). Here my application takes the backup of this file and there is finally facility to restore the same file.
        So on restore, i wanted to create folder c:\TEMP(case sensitive) and TEST.TXT in that folder.

        SO during backup statge i want to use c:\TEMP\TEST.TX T (rather than c:\temp\test.tx t user entered in UI . here issue is case sensitive and i want to extract the file property as defined on the system). Hope my requirement is clear now.

        I am not very sure an API is avialable for this.
        In windows the file name is case insensitive....
        I am not very sure an API exists for this.
        Other members please comment on this

        Raghuram

        Comment

        • arnaudk
          Contributor
          • Sep 2007
          • 425

          #5
          As gpraghuram said that should be impossible in windows since it's case-insensitive, which raises the question of why you would want to do this since filenames differing only in their case are indistinguishab le?
          Of course, you could try to read the file allocation table of the hard disk directly to determine the case of the filename but that's a whole other kettle of fish. If you're really interested in that, there are some code snippets out there which will help you. Do a google search on "how to access partition" or "low level hard disk access".

          Comment

          • sudhivns
            New Member
            • Nov 2007
            • 52

            #6
            I just want something like this:
            User enters c\temp\temp.txt in UI. But tools provides option to backup the user mentioned file. Also restore back the file in similar structure.
            In actual, if file is c\TEMP\TEMP.txt on backup and restore, i wanted to have similar directory structure (respecting case sensitive) in destination pc.
            Finally c:\TEMP\TEMP.tx t is to be backedup and deploy on other PC with same strucutre (though user mentioned like c:\temp\temp.tx t during capture operation)

            Comment

            • sudhivns
              New Member
              • Nov 2007
              • 52

              #7
              File Name preserving case information

              Hi,

              Want to retrieve the filename as reside in the disk respecting case info.
              Eg: c:\temp\imp\dat a.doc (if this how the file stored in disk) and
              is there any API thru which i can get the actual file case info if i give the path as c:\TEMP\IMP\DAT A.DOC ( should return c:\temp\imp\dat a.doc as residing in the disk).

              Bye

              Comment

              • gpraghuram
                Recognized Expert Top Contributor
                • Mar 2007
                • 1275

                #8
                I think this is already posted in this forum...

                Thanks
                raghuram

                Comment

                • sudhivns
                  New Member
                  • Nov 2007
                  • 52

                  #9
                  Yes. but there was no approach found.

                  Comment

                  • gpraghuram
                    Recognized Expert Top Contributor
                    • Mar 2007
                    • 1275

                    #10
                    Originally posted by sudhivns
                    Yes. but there was no approach found.

                    Can other experts comment on this?

                    Raghu

                    Comment

                    • mcubed
                      New Member
                      • Jun 2008
                      • 3

                      #11
                      Sorry for the late response, I'm rather new to the site.

                      Although Win32 is case insensitive it does respect the case of file names. The FindFirstFile() API may be used to determine the correct case of the desired file name. Note that this also works for retrieving the correct case for directory names, but each piece of a path name would have to be checked separately.

                      Comment

                      • mcubed
                        New Member
                        • Jun 2008
                        • 3

                        #12
                        Although Win32 is case insensitive it does respect the case of file names. The FindFirstFile() API may be used to determine the correct case of the desired file name. Note that this also works for retrieving the correct case for directory names, but each piece of a path name would have to be checked separately.

                        Comment

                        • sudhivns
                          New Member
                          • Nov 2007
                          • 52

                          #13
                          !!!! Yes it is solved now.!!!!

                          Path = "c:\temp\data\r ead.txt" (actually it is stored in disk as c:\TEMP\DATA\RE AD.TXT)

                          use GetShortPathNam e() over Path and use the return short path name in GetLongPathName (), which results in exact case of of the path u r intended. (i.e c:\TEMP\DATA\RE AD.TXT)

                          Comment

                          • Banfa
                            Recognized Expert Expert
                            • Feb 2006
                            • 9067

                            #14
                            Threads Merged, Please Don't double post

                            Banfa
                            Administrator

                            Comment

                            Working...