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

How to check if directory has write permissions.

Hi,
I post this question at a time when my neck is on the line.

i have a problem in getting the directory permission using the -w operator.

i need to get the permission before I run the xcopy system command.

I have to use core Perl modules and nothing else. So the restriction.

My code had a problem working with this operator "-w", so I created a test code to see what it returns.

I used two directories: one with write permission and the other with out.

if(-w $FROM_DIR_PATH)
{
print "\n 1 : $FROM_DIR_PATH"
}
if(!(-w $FROM_DIR_PATH))
{
print "\n 2 : $FROM_DIR_PATH"
}

if(-w $TO_DIR_PATH)
{
print "\n 3 NOT: $TO_DIR_PATH"
}
if(!(-w $TO_DIR_PATH))
{
print "\n 4 NOT: $TO_DIR_PATH"
}


---------------
OUTPUT
---------------
1 : d:\test
3 NOT: d:\temp


Here,
d:\test folder had all the right to create anything inside it.
and
d:\temp folder did not have any rights on it. (clicking on it would say "Access Denied").

How do i get the permissions on the folders then?
Am I using the "-w" operator properly??

My system has Windows XP OS.


Please help me out!!!!!!
Sep 26 '07 #1
2 10755
KevinADC
4,059 Expert 2GB
Do directories on Windows XP even have permissions?
Sep 28 '07 #2
numberwhun
3,509 Expert Mod 2GB
Do directories on Windows XP even have permissions?
I am not really sure. I know they aren't like Unix file/directory permissions, that is for sure.

Also, isn't the -w a file test? Would it work on a directory? I have never tried.

Regards,

Jeff
Sep 28 '07 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: JW | last post by:
I have a directory protected with .htaccess / .htpasswd. After I'm validated, I run a php script which bombs out when trying to write a file to that directory. If I chmod 777 on the directory...
18
by: Dino | last post by:
dear all, i've created an application for a customer where the customer can upload ..csv-files into a specified ftp-directory. on the server, a php-script, triggered by a cronjob, reads all the...
4
by: Steven | last post by:
Does anyone know if there is a way to check the access permissions of different users using C#? I need to know if a user has full control or if they have read only access or none to a certain...
2
by: GM | last post by:
Any help is greatly appreciated! I'm up against a meeting deadline. Directory.CreateDirectory Method throws UnauthorizedAccessException Here is the path: ...
3
by: James Coleman | last post by:
Hello, The following error is appearing when attempting to create a directory using the availale system.io methods: System.IO.DirectoryNotFoundException: Could not find a part of the path...
1
by: wurlds_wurst_coder | last post by:
I just want to know if the person logged in to the box has read permission or write permission on a network directory. How do I do this? introspectre ATSIGN earthlink DOT net
2
by: BLetts | last post by:
I have an ASP.NET app that must allow users to upload files. The files are stored in a virtual directory. I use Server.MapPath to map from the virtual directory name to a physical path, then the...
6
by: Fred W. | last post by:
When my application starts I need to check folder permissions to ensure they have "Full Control" before I let them proceed on. How can I check this permission. Thank you, Fred
2
by: Paul Lemke | last post by:
Hello, I currently have an application that uses authenticates users via NTLM. I would like to provide a user a directory listing of a folder. Everyone has read access to the folder, but the only...
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
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
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
agi2029
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 project—planning, coding, testing,...

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.