How to check whether a folder named RM
exists inside a directory...I have given the directory path through textbox like txtBoxInput.Text
and in this path i have to check...Any suggestion?
The isDir() function is used to check a given file is a directory or not. Here we used stat() function and S_ISREG() macro. In the main() function, we created a character array fileName. Then we read the name from the user.
$Folder = 'C:\Windows' "Test to see if folder [$Folder] exists" if (Test-Path -Path $Folder) { "Path exists!" } else { "Path doesn't exist." } This is similar to the -d $filepath operator for IF statements in Bash. True is returned if $filepath exists, otherwise False is returned.
Call DirectoryExists() to determine whether the directory specified by the Directory parameter exists. If the directory exists, the function returns True. If the directory does not exist, the function returns False.
This task can be accomplished by using the mkdir() function. Directories are created with this function. (There is also a shell command mkdir which does the same thing). The mkdir() function creates a new, empty directory with name filename.
Path.Combine and Directory.Exists ?
http://msdn.microsoft.com/en-us/library/system.io.path.combine.aspx
http://msdn.microsoft.com/en-us/library/system.io.directory.exists.aspx
if (Directory.Exists(Path.Combine(txtBoxInput.Text, "RM"))
{
// Do Stuff
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With