Is there a way to determine the number of hidden files/directories within a
directory? This is what I’m doing now:
System.IO.Direc toryInfo rootPath;
System.IO.FileS ystemInfo[] dirs, files;
int numOfDirs = 0, numOfFiles = 0;
di = new System.IO.Direc toryInfo(“bla h”);
dirs = rootPath.GetDir ectories();
files = rootPath.GetFil es();
for (int i=0; i<dirs.Length; i++)
numOfDirs += ((dirs[i].Attributes & System.IO.FileA ttributes.Hidde n) ==
System.IO.FileA ttributes.Hidde n) ? 0 : 1;
for (int i=0; i<files.Length ; i++)
numOfFiles += ((files[i].Attributes & System.IO.FileA ttributes.Hidde n) ==
System.IO.FileA ttributes.Hidde n) ? 0 : 1;
It seems like there must be a better way?
This can’t be very efficient.
Thanks,
Dale 3 4977
Hi Dale,
Regarding on the problem you mentioned ,I'm finding proper resource to
assist you and will reply as soon as possible. Thanks for your
understanding.
Regards,
Steven Cheng
Microsoft Online Support
Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
Hi Dale,
First of all, I would like to confirm my understanding of your issue. From
your description, I understand that you need to get the count for hidden
files and directorys under certain directory. If there is any
misunderstandin g, please feel free to let me know.
As far as I know, there isn't a method in current .NET framework for us to
get the count directly. In my opinion, the code you have provided is quite
good. I will do this also in this case.
Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."
Kevin,
You understand perfectly. It looks like I am already using the best method
available.
Thanks for your time.
Dale This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Lothar Scholz |
last post by:
Hello,
i know that this is not a python but a FTP protocol question but maybe
someone in this newsgroup could help me.
I use the standard ftplib.FTP class and get the listing wia
ftp.retrlines('LIST mydir')
but this does not get hidden files like ".htaccess" and more important
i can't delete directories because they are not empty.
|
by: Darren |
last post by:
Hi Group,
Any ideas how to check for files in a directory, to see if any are of the
same prefix, and make a count of them.
I have a round 100 files, the filename is made up of an engineer number
followed by a contract number.
I want to see how many files each engineer has:
|
by: Jerry |
last post by:
I'm having just a bit of trouble wrapping my brain around the task of
working with folders that are above the site's root folder.
I let users upload photos (.jpg/.gif files) which can subsequently be viewed
on the site's pages. My hosting provider is requiring that any files my Web
app writes get written to a folder that is above the app's root folder (for
security purposes).
When writing the files I understand how to use MapPath to...
|
by: laredotornado |
last post by:
Hello, Using PHP 4, is there a fucntion that counts the files in a
given directory? You can assume there are no sub-directories within
this directory and hence, no files within the sub-directories.
Thanks for any functions or one-liners. - Dave
|
by: MichiMichi |
last post by:
My asp.net application has a directory which is filled up with over 17
files (email) a second. After a while this sums up into a huge amount
of files.
I usually count files with the GETFILES method. This works perfectly
of there are only a few hundert files in the folder
*********
.....
Dim files() As String
| |
by: theCancerus |
last post by:
Hi All,
I am not sure if this is the right place to ask this question but i am
very sure you may have faced this problem, i have already found some
post related to this but not the answer i am looking for.
My problem is that i have to upload images and store them. I am using
filesystem for that.
setup is something like this, their will be items/groups/user each can
|
by: googletired |
last post by:
Ok,
I need to be able to count the # of items for each category and have it display.
So say i have a left menu that displays that category name for cat in the current issue.xml for instance en_print_200802.xml which is called form a seperate .xml volissue.xml beside each name i want to display the # of items in each category.
<?xml version="1.0" encoding="utf-8"?>
<vol_issue vol_issue_id="200802">
...
|
by: briggs |
last post by:
Hi All,
I need to take the count of txt and bak files present in all the directory.for eg if we assume there are two directoies say(test1, test2), I need to collect the count(of txt and bak files) and print it out..
I tried the below code, but could not achieve what I need.Can someone help me on the same.
Prg:
($dir, $extension) = @ARGV;
$dir = "." unless $dir;
|
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, well explore What is ONU, What Is Router, ONU & Routers main usage, and What is the difference between ONU and Router. Lets take a closer look !
Part I. Meaning of...
|
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
| |
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
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 projectplanning, coding, testing, and deploymentwithout human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
|
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |