473,387 Members | 1,485 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,387 software developers and data experts.

How do I check if a directory exists within another directory

Hi,

How do I check if a directory exists within another directory?

For example

C:/aaa C:/Aaa = true
C:/aaa/ C:/Aaa/bb = true
C:/aaa/ C:/Aaa/bb/cc = true
C:/bb/ C:/aa/ = false

Thanks,

Aine

Nov 8 '07 #1
1 2543
For these simple cases, how about:

if (dir.ToLower().StartsWith (subDir.ToLower()))
{}

<ai********@yahoo.comwrote in message
news:11**********************@e9g2000prf.googlegro ups.com...
Hi,

How do I check if a directory exists within another directory?

For example

C:/aaa C:/Aaa = true
C:/aaa/ C:/Aaa/bb = true
C:/aaa/ C:/Aaa/bb/cc = true
C:/bb/ C:/aa/ = false

Thanks,

Aine

Nov 8 '07 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Smitha Nataraj | last post by:
Hello, I need to create a Virtual Directory in C#. Pls let me know if you have any hints regarding this.. Thanks, Smitha
1
by: Pgar | last post by:
I have a page that I have the users uploading files from their local machines. I take these files strip off their path and redirect it to a new file on the web server. I have a virtual directory...
6
by: dave | last post by:
Hello All - Is there a way to check if a file path string is valid? I.e. is there a function that takes some string, say 'c:\somedir\subdir' and returns TRUE if it is valid or FALSE if no such...
1
by: Steven J. Reed | last post by:
I am trying to find out is a folder exists within a share on a server. I can successfully determine if a file exists within the share, but I can't figure out how to determine if it's parent folder...
10
by: Ricardo Luceac | last post by:
Hi all. I'm having a problem with this, I have look if a file exists, if don't wait till it is created and if it exists I need to open it. I do the following: for (; ; ) {
4
by: yinglcs | last post by:
I check the documentation here, but it does not say how to check if a directory is exist in python? http://docs.python.org/lib/os-file-dir.html And why mkdir fails if the directory already...
5
by: sword | last post by:
How can I check whether a file exists?
2
by: CCLeasing | last post by:
If (Directory.Exists(@"c:\indigo\" + txtOfficial + @"\" + comOffice.Text + @"\" + numTerm.Value.ToString())) { storereport(); } else { Directory.CreateDirectory(@"c:\indigo\" + txtOfficial +...
9
by: shughes | last post by:
i am not really a programmer, so i have a question on the system.io.directory.exists what i am trying to do is have a button, once this button is clicked it checks to see if the Directory...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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...

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.