Jump to content

Unable to unset Read-only attribute of directory


Recommended Posts

Hi,

I am facing a problem with directory attribute. I have a script that creates a sub-directory inside a given dir.

For example, the script creates directory 'auto' inside G:\root\

The script then tries to MOVE a directory from a given location to G:\root\auto\

The problem is that when it tries to perform the MOVE operation, it gets ‘Access Denied’ message. After some investigation, I found that the issue was with the parent directory G:\root. If I unset the Read-only attribute of only the G:\root folder ('auto' directory’s attribute is left as it is), the script successfully performs the MOVE operation.

This script worked fine when I executed it for the first time. As this script is scheduled to run twice a day, I noticed that the script was failing at the MOVE operation every time.

I am not sure why this is happening. :( This is weird for me because the issue seems to be with the parent folder and not the child folder that is actually getting created. Is there any way to rectify this behaviour?

I am not sure whether ATTRIB command will work. I have to try it out.

Any suggestions?

Regards,

GC

Link to comment
Share on other sites

This script worked fine when I executed it for the first time

Can you post this script here please.

People on all different levels read the posts and are very willing to learn.

Your input is appreciated.

Meanwhile, back to your most recent post:


/>http://forums.windowsforum.org/index.php?showtopic=45698

Did executing your 4.exe files along with a .bat file work out within the boundaries of the links that I gave you ? - Or do you think it beyond you level of expertise at this present moment in time ?

If you have had a favourable result please publish it here, as we are very willing to learn.

John.

Link to comment
Share on other sites

Hi John,

This issue is fixed now. After few more tests, I realized that the problem was not with the parent folder attribute. I modified my script to test whether the same error occurs when I try to create a directory just inside G:\ instead of G:\root. The same error came up again.

I thought of adding “ATTRIB –r G:\auto” before performing MOVE operation; still nothing happened. Then I was sure that there might be some issue with the source folder itself; I was correct this time.

A log file in source folder was tied up to a process. After releasing that handle, everything is working fine now. :)

Thanks for your inputs.

Regards,

GC

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. Privacy Policy