473,398 Members | 2,368 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,398 software developers and data experts.

Getting File Properties info

Hi,

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

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

Bye
May 17 '08 #1
13 3455
gpraghuram
1,275 Expert 1GB
Hi,

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

Basically wanted to retrieve the file name as stored in system rather than if user specifies c:\temp\test.data (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
May 20 '08 #2
My requirement goes something like this.
if user enters (in UI) c:\temp\test.txt , but actually system storage is as c:\TEMP\TEST.TXT(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.TXT (rather than c:\temp\test.txt 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.
May 20 '08 #3
gpraghuram
1,275 Expert 1GB
My requirement goes something like this.
if user enters (in UI) c:\temp\test.txt , but actually system storage is as c:\TEMP\TEST.TXT(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.TXT (rather than c:\temp\test.txt 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
May 20 '08 #4
arnaudk
424 256MB
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 indistinguishable?
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".
May 20 '08 #5
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.txt is to be backedup and deploy on other PC with same strucutre (though user mentioned like c:\temp\temp.txt during capture operation)
May 21 '08 #6
Hi,

Want to retrieve the filename as reside in the disk respecting case info.
Eg: c:\temp\imp\data.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\DATA.DOC ( should return c:\temp\imp\data.doc as residing in the disk).

Bye
Jun 24 '08 #7
gpraghuram
1,275 Expert 1GB
I think this is already posted in this forum...

Thanks
raghuram
Jun 24 '08 #8
Yes. but there was no approach found.
Jun 24 '08 #9
gpraghuram
1,275 Expert 1GB
Yes. but there was no approach found.

Can other experts comment on this?

Raghu
Jun 25 '08 #10
mcubed
3
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.
Jun 26 '08 #11
mcubed
3
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.
Jun 26 '08 #12
!!!! Yes it is solved now.!!!!

Path = "c:\temp\data\read.txt" (actually it is stored in disk as c:\TEMP\DATA\READ.TXT)

use GetShortPathName() 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\READ.TXT)
Jul 31 '08 #13
Banfa
9,065 Expert Mod 8TB
Threads Merged, Please Don't double post

Banfa
Administrator
Jul 31 '08 #14

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: Hal Vaughan | last post by:
I've seen install programs that search a hard drive for previous instances of a program, or to find installs of other needed programs. I need to search a hard drive for any installations of...
5
by: Ram [MSFT] | last post by:
Hi All, I'm trying to programatically (using c#) read the file properties (Title, Summary, Author, Comments etc.... The stuff that shows up on the Summary tab when you see the properties of a...
4
by: Larry Tate | last post by:
I am wanting to get those cool html error pages that ms produces when I hit an error in asp.net. For instance, when I get a compilation error I get an html error page that shows me the ...
2
by: Valerian John | last post by:
Hello: In ASP.NET, how can one get the properties (length of audio clip, length of video clip, dimensions of gif or jpg, etc.) for any given file? I am primarily interested in media files. One...
1
by: z. f. | last post by:
Hi, i have a asp.net vb.net web appliation. it is compiled to release build with debug information. i have module to analyze errors in application_onError to trap all errors in my code and...
3
by: Nathan Sokalski | last post by:
I need to get the width and height of a GIF image through code. I need this info so that I can set the width and height properties of Image and ImageButton objects....
5
by: IcingDeath via DotNetMonster.com | last post by:
I am building this SQL Server database app in which i can store files. In order to display files I want to have the app show the associated icon for the extension of the file that is in the...
2
by: MSK | last post by:
Hi, Continued to my earlier post regaring "Breakpoints are not getting hit" , I have comeup with more input this time.. Kindly give me some idea. I am a newbie to .NET, recently I installed...
3
by: adtvff | last post by:
Hi, Given a large ascii file (delimited or fixed width) with one ID field and dimensions/measures fields, sorted by dimensions, I'd like to "flatten" or "rollup" the file by creating new...
33
by: JamesB | last post by:
I am writing a service that monitors when a particular app is started. Works, but I need to get the user who is currently logged in, and of course Environment.UserName returns the service logon...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.