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

Determining if a directory is writeable

Is there something built-in to .net to determine if a directory is writeable
by the current user?

I want to write a Windows Powershell script that needs to write to a
directory. I can certainly do something in PSH to get the current user,
then determine if the ACLs will allow writing, but perhaps .net has a
one-liner?

I know I can also just use PSH to try to write to the dir, then retrive the
error value. Still, wondering if there's a prettier solution...

Marco
Nov 23 '06 #1
1 4209
Same way to determine if cookies are enabled, try to write and test the
status of the return. I think you want to delve into the DirectoryInfo
class.

<%= Clinton Gallagher
NET csgallagher AT metromilwaukee.com
URL http://clintongallagher.metromilwaukee.com/
MAP http://wikimapia.org/#y=43038073&x=-...8&z=17&l=0&m=h
"Marco Shaw" <ma***@Znbnet.nb.cawrote in message
news:OT**************@TK2MSFTNGP02.phx.gbl...
Is there something built-in to .net to determine if a directory is
writeable
by the current user?

I want to write a Windows Powershell script that needs to write to a
directory. I can certainly do something in PSH to get the current user,
then determine if the ACLs will allow writing, but perhaps .net has a
one-liner?

I know I can also just use PSH to try to write to the dir, then retrive
the
error value. Still, wondering if there's a prettier solution...

Marco

Nov 23 '06 #2

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

Similar topics

4
by: Hugh Cowan | last post by:
Hello, I am currently running PHP 4.3.2 on Windows NT 4.0. Is there anyway (I am sure there is but I just can't find it) that you can determine the path of the current script that is running?...
2
by: Brian Richmond | last post by:
I'm writing a script to upload images along with articles to a directory on the server. I'm developing it offline on my WinXP and Apache 1.3.x laptop and it's working great, but when I move the...
3
by: Dfenestr8 | last post by:
os.listdir("path") returns the names of all the items in a directory ok, but I need to know whether the item is a file or a directory. Can anybody tell me how this could be done?
2
by: Phil Galey | last post by:
Using the following, you can determine the size of a file: Dim fi As New IO.FileInfo(<Path to file>) MsgBox(fi.Length) .... but what about the size of a directory? The IO.DirectoryInfo object...
2
by: bballr | last post by:
I have a problem that I'm not sure if it can be done. I'm trying to use the MySQL C API to be able to use a normal sql insert statement that will send the data or file to a directory and NOT the...
0
by: Just D. | last post by:
All, I created a tool to setup our web apps, it does almost everything now, but how can we change the property of one of the subdirectories? One of the subdirectories should be made Writeable. ...
4
by: petermichaux | last post by:
Hi, I'm hoping for a reason I'm wrong or an alternate solution... I'd like to be able to dynamically include some javascript files. This is like scriptaculous.js library but their solution is...
1
by: topher | last post by:
When using filesystemwatcher to keep an eye on a directory to see if there are any files, how will I know when it is safe to work on the files in a directory? In other words, how will I know that...
1
by: jaleel | last post by:
In a windows application I have an xml file which is readable and writeable. I wnat to ensure that this file is writeable if it is set to read-only. I am doing my work using the code: ...
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: 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
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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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.