Determining if path name exist

How do I find out if a Path Name exist.

I have a CString that contain a Path Name (no file name associated
with this path name). All I want to do is determine if this path name
exist and if it doesn't, prompt the user that the path name does not
exist and if the path name should be created.



jvasquez (6)
1/28/2004 5:17:10 PM
vc.mfc 33608 articles. 0 followers. Follow

6 Replies

Similar Articles

[PageSpeed] 37

On Wed, 28 Jan 2004 09:17:10 -0800, John <>

>How do I find out if a Path Name exist.
>I have a CString that contain a Path Name (no file name associated
>with this path name). All I want to do is determine if this path name
>exist and if it doesn't, prompt the user that the path name does not
>exist and if the path name should be created.

have a look at the API

1/28/2004 5:47:27 PM
attention: MakeSureDirectoryPathExists() creates the path, if he doesn't

if u are looking for if a directory exists, use PathIsDirectory(....)

kg muechel

Muechel (42)
1/28/2004 6:16:48 PM
        BOOL bPathExists = ( INVALID_FILE_ATTRIBUTES != GetFileAttributes(
sPathName ) );

Check Abdoul [VC++ MVP]
"John" <> wrote in message
> How do I find out if a Path Name exist.
> I have a CString that contain a Path Name (no file name associated
> with this path name). All I want to do is determine if this path name
> exist and if it doesn't, prompt the user that the path name does not
> exist and if the path name should be created.
> Thanks
> John

1/28/2004 6:17:36 PM
I tried PathIsDirectory but I'm getting a compile error,
'PathIsDirectory' : undeclared identifier.

How do I get the compiler to recognize PathIsDirecotory? What include
file am I missing. I'm using this in a CView class.


On Wed, 28 Jan 2004 19:16:48 +0100, "M�chel" <> wrote:

>attention: MakeSureDirectoryPathExists() creates the path, if he doesn't
>if u are looking for if a directory exists, use PathIsDirectory(....)
>kg muechel

jvasquez (6)
1/28/2004 11:45:35 PM
Thanks, I'll check this one out. Used it, forgot about it.


On Wed, 28 Jan 2004 13:17:36 -0500, "CheckAbdoul" <checkabdoul at mvps
dot org> wrote:

>        BOOL bPathExists = ( INVALID_FILE_ATTRIBUTES != GetFileAttributes(
>sPathName ) );

jvasquez (6)
1/28/2004 11:49:56 PM
PathIsDirectory and all other path functions are defined in Shlwapi.h

see msdn

all path functions :

PathAddBackslash, PathAddExtension, PathAppend, PathBuildRoot,
PathCanonicalize, PathCombine,
PathCompactPath, PathCompactPathEx, PathCommonPrefix, PathFileExists,
PathFindFileName, PathFindNextComponent, PathFindOnPath, PathGetArgs,
PathGetDriveNumber, PathIsContentType, PathIsDirectory, PathIsFileSpec,
PathIsPrefix, PathIsRelative, PathIsRoot, PathIsSameRoot,
PathIsSystemFolder, PathIsUNC,
PathIsUNCServer, PathIsUNCServerShare, PathIsURL, PathMakePretty,
PathMatchSpec, PathParseIconLocation, PathQuoteSpaces, PathRelativePathTo,
PathRemoveBackslash, PathRemoveBlanks, PathRemoveExtension,
PathRenameExtension, PathSearchAndQualify, PathSetDlgItemPath, PathSkipRoot,
PathStripToRoot, PathUnmakeSystemFolder, PathUnquoteSpaces

kg muechel

Muechel (42)
1/29/2004 11:01:40 AM

Similar Artilces:

Table names in recordsets?
If I have an SQL call e.g. SELECT * FROM Customers In the returned recordset, how to I access the data with the table name e.g. rs("Customers.ID") rs("Customers.Name") rs("Customers.Address") I can only get it to work without the table name e.g. rs("ID") rs("Name") rs("Address") My SQL string can change at runtime, and I may have duplicate field names so I want to make sure I'm accessing the correct field from the correct table. Thanks Jon Then why not alias the duplicate field names in your SQL? Alternatively, you can re...

Flipping naming conventions to match two tables
I have Table #1 that has the name field shown as "First Last". Table #2 has been randomly keyed in by someone with the names as: "First Last", and others "Last First" and yet others that are: "Last, Middle, First." I attempted to try the instructions from a post here labeled "Fuzzy search." However, the MID function does not work due to the random naming conventions keyed in Table 2. Is there another way I can program a query to conform Table 2 so that it matches the consistent naming conventions of Table #1? Guitarzann, ...

Domain name and addresses not managed by the Exchange server
Hello I would like to know if it is possible to configure the Exchange server to send out E-Mails from his own domain name when it cannot resolve them. I explain it: let's say that the domain name is That domain name is used in several locations that are NOT connected together but abc represents them all. One location decides to install an Exchange server to manage its mail accounts. It uses the domain name. If that location tries to send an E-Mail to another E-Mail account that is not recognized by the Exchange server (in our example, someone in another l...

How do I reference external data from a file, file name found in .
How do I reference data from a file when the file name is found in destination workbook. i.e. I want to be able to have a cell whjere i type in source desitnation file name and the workbook will reference that file in a range If you build your formula with the reference to that closed workbook, excel will handle it nicely. I like to open the other workbook. Build the formula and use the mouse to point at that other range(?) in the other workbook. Then when I close that other workbook, my formula's syntax will be perfect--excel did all the real tough work! If you put the workbook...

Outlook 2003 not able to resolve names "First Last"?
My company just implemented Windows XP/Outlook 2003, and when I type the first and last name in the "To" field, example: "John Smith", the name does not resolve, and will give me a "does not recognize" message when I try to send. However, if I type it in as "Smith,John" it will resolve just fine and also be remembered when I type it again. I contacted one of our technical support people and they said that this is just new functionality with 2003. (So pretty much I should learn to live with it.) Since I'm part of a pilot group for this ne...

name shown as the email sender
When I set up my live mail I didn't enter my name as the name shown when recipients receive an email from me so it shows my email address. How do I correct this and change what shows as my name? Tools - Accounts - youraccount - Properties If you don't see the Menu bar, press the Alt key "Sharon Huddleston" <Sharon> wrote in message > When I set up my live mail I didn't enter my name as the name shown when > recipients receive an email from me so...

Macro Names display
In my reinstallation of Excel 2007, in the list of macros (Alt+F8) the name of the workbook containing the macro is displayed first followed by the macro name which makes it quite difficult to track down the one you are after. I don't think workbook names were shown in the previous installation of Excel. Is it possible to change the setting so only the macro names are displayed? "Pete" <> wrote... >In my reinstallation of Excel 2007, in the list of macros (Alt+F8) >the name of the workbook containing the macro is displayed first >follow...

Update the originating lead on an existing opporutinty
Is there any way to update the originating lead field on an existing opporutinty. The field is read only once the opporutnity is saved. When you are creating a new opporutnity you can set this field, but after you push save no further changes can be made. You are also unable to set this value via workflow. We are using CRM 4.0 Hi Chris, I afraid it is not possible. It is suppose to be not updatable. Only possibility is direct SQL update which is unsupported. -- uMar Khan :: MS CRM MVP Microsoft CRM Consultant Email :: imumar at gmail dot com Blog :: MV...

Deleting file and path
I have a form that is bound to a hyperlink table. I have a delete button with which you can delete the particular hyperlink record including the underlying file. The function that executes the code, first tries to delete the file. If that's successful, the hyperlink record is deleted. There could be situations where the hyperlink record can't be deleted for instance because it's locked. In that case the function would already have deleted the file, while the hyperlink record remains there. Is there a way I could perhaps 'pre-lock' the hyperlink record, so ...

Email address already exist
We have one WINNT server and one exchg srvr 5.5. All of sudden one of the users email came back as undelivered. We download external emails using outlook pop settings and deliver msgs to pst . exchg server is used for public folders and emails within office correspondence. After checking all settings, I deleted that user mailbox in exchg, recreate it and mapped to same user accnt in domain but when I put email address in newly created accnt of that user, the following errors pops up: "The email address already exists in the organization,ID no. C10312e7" The external emails can...

Using Defined Names for Column Values?
I want to create a spreadsheet model that uses defined names, but then I would like to duplicate the model in one column across several columns and call each of those a scenario. For example, you might run a stock option model and see how it changes as you vary some input like the stock option strike price. Is there any way in any version of Excel to have a defined name and then qualify that by the column? For example, if I had a Defined Name "Strike_Price" it would be so nice to be able to refer to column values as: Strike_Price.E Strike_Price.F Strike...

How to open a Template under a different name, preferably the dat
Hello, I want to open an excelworkbook from a template, this works fine by just opening the template. But when opening an excelworkbook generated by the template. It names the file, and adds a 1 to the filename. Example --> (action)open template named book1.xlt It opens a excelworkbook named book11.xls. What i want is that, when you open the template it names it with the time and date as filename for the excelworkbook. So that everytime you open the template you can save your copy of the workbook under the time and date when the file was opened. I know this is possible, because i'...

How to get Address cards to be in order of First name and then last name (and not in "file as" order)?
Outlook2003/winXP Hi After persistent errors when downloading new emails, I have just copied my contacts across into a new PST file. The problem is that now in "Address Card" view some names are in "Last name, then first name" order, whereas many other entries are in "First name then last name" order. Looking more closely, if there is a comma between the names then it always shows the Lastname first. How do I stop this?! If I go to "Tools" > "email accounts" > V"iew or change existing directories or address book" there is ...

My Contact Display Names in Outlook 2007
First, let me state I am not as computer savvy as you undoubtedly are, so please help me in layman terms if possible. I updated to Office 2007 and use Outlook Connector (most recent version downloaded). I always was able to have just the display name show WITHOUT the person's email address showing. Now, even if I go through list one by one and delete the email addresses next to the name displayed, when I close Outlook and re-open it, the email addresses are back next to the display name again. What am I doing incorrectly? Thank you for your help. There's not enough...

Excel 97 message, "A document with the name '-----.xls' is already open. . . ."
I've just installed Excel 97 on a new computer. It works fine when I start Excel first and then open a file. But when I double-click on the file to start Excel, it opens the file all right but then warns me that that file's already open and I "cannot open two documents with the same name." It does this every time, though there isn't really another file open. It doesn't prevent me from working with the file, it's just annoying. How do I get rid of this false warning? Neil Try the usual fix(es) for this problem. Tools>Options>General uncheck &quo...

Err.Description as error proc name trail, error handling
Hi All, I'm looking for guidance on how to retrofit into a large AddIn the 'best' or possible uses of the Err object in providing an information path to help track down run time errors in a 'production' environment. Some Background, 4 questions follow. I was new to VBA, self taught, when the coding started, (but with experience in other languages), and the vba error handling seemed too complex at the time, huge mistake on my part. The procs below are learning vehicles, which I'm just starting to play with, but they do show the essence o...

Dual language mailbox names
We recently setup new exchange 2003 servers for our organisation, however during setup we activated all mailboxes with English mailbox settings. Now we have outlook clients with mailbox settings in English & Swedish.We have set the system to create in Swedish now. How would I change the settings back to Swedish for those boxes taht have already been created? .. rob582 wrote: > We recently setup new exchange 2003 servers for our > organisation, however during setup we activated all > mailboxes with English mailbox set...

Problems with 'Names'
I am using MS Excel 2007. I have a series of linked files - 1 main 'parent' file with 5 'children' files. The parent file contains 'names' which are used in all the children files (eg..titles across columns, drop down boxes/lists (referencing name ranges) etc) I need to find and replace some of the external links in the files with new file extensions - XLSM and XLSX. I can find and replace as required in all the formulas which work, however the 'names' in the file still refer to the .XLSM file. If you search the entire workbook .XLSM cann...

How do I change email display name for exchange email user account so that instead of existing: John Doe < > New email display name would be: Design < > Please provide details or article? I tried changing email display name in AD users but it is still showing old info when I send emails. "Anthony" <> wrote: >How do I change email display name for exchange email >user account so that instead of existing: > >John Doe < > > >New email display name would be: >D...

Populate a new field in an existing table
Hi all Access 2003: I have an existing Access table, containing 10,000+ rows called "Printing" and I have decided to insert a new column called "Financial Year". However, I am struggling of finding a way to instantly populate this field with the value "2009-10", without going into each row (I have three more tables to do this to with 30,000+ rows) Going forward it will be populated with all the other fields, but I just need to bring them all up to date first. Can anyone help out? Thanks for reading. DominicB Write a query to do an in...

Naming a query
hi i have created a query but for some reason no matter what i name it even "query 1" access seems to bring up an error message saying " query1 is not a valid name. Make sure that it does not include invalid characters or punctuation and that it is not too long" i've never had this problem before. And just one other thing does anyone know when creating a query how to add a drop down box so that users can only select from the options rather than typing in the result for the query. Thank you Sheena ok so i have managed to work out why access wasnt allowing me ...

Server Name and Outlook
I am in the process of setting up an Exchange server. My domain name on the DC is domain.local. So, the exchange server name is servername.domain.local. During my testing, I have Outlook 2003 running at my house. I currently have a VPN to my office. When I go into Outlook to connect to the exchange server it wants to connect using servername.domain.local, but I want it to connect using How do I get Exchange to also use the domain name for connections? Thanks, Jeff In, Jeff Grossman <jeff.nospa...

combo box named range
First of all, I wanna let all you guys know you are great and have taught me a lot of excel in little over a week here. So I have a little brain teaser. I am making a spreadsheet with three drop down lists, the last two dependent on succession. From the first, you pick either the word "foreign" or "domestic." That is followed in the next column by a list that will let you pick either a US State or a national country, depending on your first selection. The last column is a city column that will let you pick a city in one of the state/countries. To make scrolling easi...

Naming a chart
How do I name a chart so that it may be referred to in VBA code? The Help documentation indicates that this may be done by selecting the chart and typing in the Name box. This did not work for me however. Lynn - You have to hold down Shift while selecting the chart, so the resizing handles are white. This means the ChartObject (the container, or parent, for the chart) is selected; the ChartObject is the thing you need to name. Now type a new name into the Name box, and press Enter. In vba you would use this syntax: ActiveChart.Parent.Name = "MyChart" Now you refer to th...

Changing E2K3 server name
Are there any known issues from changing the NetBIOS name of the server where Exchange 2003 is already installed. We are migrating our e-mail from SendMail for NT (running on an stand-alone NT box, name Mail [NetBios] and []]) to an internal AD-member W2K3 server. Our manager wants to keep the name exactly the same (both NetBIOS and DNS). We figured initially we give the W2K3 server a different IP address (x.x.x.100) and a different NetBIOS name (ismail), get Exchange installed and configured. And then we can switch the IP address to the one (x.x.x.9) that is used to...