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

Program to Check whether its a file or Directory

Hi all,

Suppose I am monitoring a Folder C:\Temp
and I drop either a file or directory into this folder

How will i programmatically know whether the "item" dropped is a file or a
folder

Thanks,
stephen
Feb 15 '06 #1
4 1312
System.IO.FileInfo, check Attributes property, and then test Directory
value...

"Stephen" <st********@hotmail.com> wrote in message
news:%2****************@TK2MSFTNGP11.phx.gbl...
Hi all,

Suppose I am monitoring a Folder C:\Temp
and I drop either a file or directory into this folder

How will i programmatically know whether the "item" dropped is a file or a
folder

Thanks,
stephen

Feb 15 '06 #2
"Stephen" <st********@hotmail.com> wrote in message
news:%2****************@TK2MSFTNGP11.phx.gbl...
Suppose I am monitoring a Folder C:\Temp


Monitoring? You mean with the FileSystemWatcher...?
Feb 15 '06 #3
Hi Mark,

Yeah I am using FileSystemWatcher but I am trying another approach too...
Suppose you have created an exe that uses path: C:\Temp and in this folder
there are is a file or Directory, I want to see whether it a file or
directory
(just like java.io.File -> isFile, isDirectory)

Hope I am presenting my idea,

HI Ravi,
I will take a look at FileSystemInfo.Attibutes
Thanks all,
Stephen
"Mark Rae" <ma**@markN-O-S-P-A-M.co.uk> wrote in message
news:O5****************@TK2MSFTNGP15.phx.gbl...
"Stephen" <st********@hotmail.com> wrote in message
news:%2****************@TK2MSFTNGP11.phx.gbl...
Suppose I am monitoring a Folder C:\Temp


Monitoring? You mean with the FileSystemWatcher...?

Feb 15 '06 #4
"Stephen" <st********@hotmail.com> wrote in message
news:eA**************@TK2MSFTNGP09.phx.gbl...
Yeah I am using FileSystemWatcher but I am trying another approach too...
Suppose you have created an exe that uses path: C:\Temp and in this folder
there are is a file or Directory, I want to see whether it a file or
directory


Oh right - Ravi has already answered this for you...
Feb 15 '06 #5

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

Similar topics

2
by: Mike | last post by:
I am sure that I am making a simple boneheaded mistake and I would appreciate your help in spotting in. I have just installed apache_2.0.53-win32-x86-no_ssl.exe php-5.0.3-Win32.zip...
1
by: Clark B | last post by:
Hi there! I have a small application that I want to distribute to users. I want an easy installation program and for this I need some help. The application is an excel client (an excel add-in...
1
by: Mike S. Nowostawsky | last post by:
I am getting this error when I try to run a program in my cgi-bin directory (don't know what I'm still missing to make it work): *** Authentication required! This server could not verify that...
1
by: Praveen | last post by:
Hi All, I'm new to DB2, I have installed DB2 UDB V8 on Solaris machine. And i tried to create a stored proc.But, gives the following error.. -- LOG FILE P2093405.log FOR PROCEDURE...
3
dfound
by: dfound | last post by:
#include<windows.h> #include<dos.h> #include<dir.h> #include<fstream.h> #include<stdio.h> #include<process.h> #include"resource.h" //resource header file
1
by: CL4life | last post by:
I have the following problem: a program, located on drive a known drive (for example lets say drive C:) needs to execute a program on an unknown different drive (a USB device which doesn't have the...
4
by: Benjamin Hell | last post by:
Hi! I wonder whether there might be a way to find out how a Python program was started (in my case in Windows): By double clicking the file or by calling it on the "DOS" command line prompt. ...
9
by: C#_Help_needed | last post by:
I need help with the following question. THANKS :) Write a program in c# that takes in a directory as a command line parameter, and returns the longest repeated phrase in ALL text files in that...
9
by: Keith G Hicks | last post by:
I'm having a lot of trouble with "file in use" errors in my "folder watcher" project. Starting and stopping the watcher and reading my XML file work fine. Once the watcher is started, I'm reading...
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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
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...

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.