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

is there a way to identify temp directories by attributes?

I'm dealing with a C# application that monitors changes to the file
system, and need to exclude irrelevent directories, temp directories
for example.

Is there any way to identify such directories, perhaps through
DirectoryInfo or something similar that might give some attribute that
temp, system, hidden, etc directories might be tagged with?

I wanted to write this code to check and ignore such directories
dynamically based on attriebutes, rather than find all the locations
that windows seems to put temp file and hard code exclusions.

Any help would be much appreciated.
Nov 16 '05 #1
1 1536
Tem directories could be any directories within the file system and don't
have any special attribute. You can simulate what the Win32 function
GetTempPath does as follows:

string GetTempPath()

{

string res = Environment.GetEnvironmentVariable("TMP");

if ( res == null )

{

res = Environment.GetEnvironmentVariable("TEMP");

if ( res == null)

{

res = Environment. CurrentDirectory;

}

}

return res;

}

You can find also many other directories that you may want to ignore (like
cookies, temporary internet, application data, etc. ) using
Environment.GetFolderPath You must take into account that all those methods
return the desired directories for the current logged on user.

Hope this help,

Idael
..
"Heath" <he***@callbacksfa.com> wrote in message
news:a5*************************@posting.google.co m...
I'm dealing with a C# application that monitors changes to the file
system, and need to exclude irrelevent directories, temp directories
for example.

Is there any way to identify such directories, perhaps through
DirectoryInfo or something similar that might give some attribute that
temp, system, hidden, etc directories might be tagged with?

I wanted to write this code to check and ignore such directories
dynamically based on attriebutes, rather than find all the locations
that windows seems to put temp file and hard code exclusions.

Any help would be much appreciated.

Nov 16 '05 #2

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

Similar topics

5
by: Tum | last post by:
Hi folks, I've been trying to make a decision and it's driving me crazy. Is a directory a file or is a directory NOT a file but a node? Should I have A)
3
by: Dale | last post by:
Is there a way to determine the number of hidden files/directories within a directory? This is what I’m doing now: System.IO.DirectoryInfo rootPath; System.IO.FileSystemInfo dirs, files; int...
2
by: Lars Netzel | last post by:
I'm trying to write a PDF to disk on the server (crystal reports export) I'm getting aproblem that Access is denied to save the file to disk and reading here (you don't need to read):...
2
by: Vishwanathan Raman | last post by:
Hi I am building a Search Interface.It has two text boxes (box1 and box2) and two buttons (btnbox1 and btnbox2) in the ASPX page. Example User keys in a search text in box2 and presses the...
5
by: rbt | last post by:
What is the most efficient way to recursively remove files and directories? Currently, I'm using os.walk() to unlink any files present, then I call os.walk() again with the topdown=False option...
2
by: William LaMartin | last post by:
Does anyone have a method of determining if a visitor to a web page is using a Palm or Blackberry mobile device? With the code below, I can easily identify a Window CE, Pocket PC or Window...
6
by: Charlie Bear | last post by:
i'm really stuck with this one can anyone help! i have a website that uses c#. it creates a series of directories and files from an xml source. when the xml changes, the directory that the...
3
by: hardieca | last post by:
Hi, I have decorated a number of my classes with a custom attribute. I would like to loop through every type in my application, sniff for the attribute, and eventually publish the entire list of...
3
by: Nathan Sokalski | last post by:
I am getting the list of subdirectories from a specified directory using System.IO.Directory.GetDirectories(), and would like to get only subdirectories that are not hidden or system directories. I...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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...

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.