1.

Solve : Attrib to remove read-only from folder nested within everything else read-only?

Answer»

Trying to figure out a way in batch without going the easy route of windows interface to remove read-only attribute from "Screenshots" folder of this current WoW game CLIENT.

I found that by running a non fully patched client I can play WORLD of Warcraft with the original legacy textures and skins, but once the client is fully patched the new textures and skins enable. I dont care for the new look and Blizzard has yet to make it a option to enable/disable legacy character appearances for those of us who dont care for the new look.

What i am trying to do is make the game client read-only for everything except for the screenshots folder which will have new screenshot pictures ADDED to it from time to time. This should kill blizzard from forcing the newest textures to my system and allow for me to continue to play this way until at some point when they kill off the legacy textures through a clean-up patch. The game client functions fine within a read-only environment, but unable to add new screenshots to the screenshots folder unless I remove the read only attribute to the folder.

I could just simply do this with windows under folder properties to remove the read only attribute, but that i am stumped on how to do it in batch, i figured I'd share what i was doing here to see if someone can point out what i need to do or am doing wrong. Its too bad the ATTRIB doesnt have an EXCLUDE switch to list what to exclude when assigning the Read-Only attribute to a folder and files and folders within it. Maybe there is a better command line tool out there to do this than the regular ATTRIB function built into Windows command shell.

Here is what I have that works in setting everything read-only, but the second instruction to remove the read-only attribute only does this for files within Screenshots and does not remove the read-only attribute from the Screenshots folder itself. 
Code: [Select]attrib +r c:\Wow6\*.* /S /D
attrib -r c:\Wow6\screenshots\*.* /S /D
pause

This is in relation to this: http://www.usgamer.net/articles/the-changing-face-of-world-of-warcraft

Also to note that their battlenet update client searches drives for the location of World of Warcraft and even though masked by the C:\wow6 instead of C:\Program Files\World of Warcraft path no matter where it hides on a hard drive the updater will detect it and try to update its contents even if you dont want it to. So the read-only method is the only thing i could come up with to stop it from updating.

The other oddity is the messages about the "Not resetting hidden file" which i am not sure if I can clean up to resolve, but one of the files looks like a hidden local database and the other looks like a hidden log, so forcing these read-only is probably not critical as for it has nothing to do with texture files etc.


Quote

C:\Documents and Settings\Dave\Desktop>attrib +r c:\Wow6\*.* /S /D
Not resetting hidden file - C:\Wow6\Screenshots\Thumbs.db
Not resetting hidden file - C:\Wow6\.agent.db
Not resetting hidden file - C:\Wow6\.patch.result

C:\Documents and Settings\Dave\Desktop>attrib -r c:\Wow6\screenshots\*.* /S
 /D
Not resetting hidden file - C:\Wow6\screenshots\Thumbs.db

C:\Documents and Settings\Dave\Desktop>pause
Press any key to continue . . .
UPDATE on this:

Still unable to figure out how to attrib to have the screenshots folder the only folder with read/write privileges within WoW6 which everything else is read only, without cheating and just doing it through Windows GUI.

I contacted Blizzard to see if they have been working on a fix for those who dislike the new Character Models. The good thing is that many people flooded them with demands to have a choice to have the original models back. I was pointed to a FEATURE that was slipped into their game client that allowed me to disable the new models and have the game run with the original character models, so the read-only attribute no longer has to be set for the game client and it can fully patch now.

So other than curiosity on how to go about the read only attribute set on a folder, with all files within it read-only, except for 1 sub-folder within it and its contents not set to read-only, I guess the intent for the batch is no longer necessary, but finding out if there is still a way to do this in batch still has my interest if its not going to be a waste of anyones time to show how in case I need to do this with other games in the future to have certain folders and files read-only and others able to be overwritten.

One THOUGHT I had as I was typing this now is, would I have to deconstruct the folders to say xcopy all but the screenshots folder to another location, set the attrib to read-only for all files and folders and then have to slip the screenshots folder back into it as the only means to do this since attrib doesnt have an exclude switch like xcopy has?

Pic attached shows how to change the character model option from within the game client advanced system settings, in case anyone else out there plays wow and wants to know how to go back to the original look of the characters.

This is my one female night elf resto druid that I dislike the new character model and prefer the original appearance.



[attachment deleted by admin to conserve space]Set a folder or a file to read only doesn't keep you from deleting it or replacing it.  You would need to set File Permissions for that. Quote from: DaveLembke on February 12, 2015, 12:09:02 PM
Here is what I have that works in setting everything read-only, but the second instruction to remove the read-only attribute only does this for files within Screenshots and does not remove the read-only attribute from the Screenshots folder itself. 
Code: [Select]attrib +r c:\Wow6\*.* /S /D
attrib -r c:\Wow6\screenshots\*.* /S /D
pause


I didn't follow your post too closely but to change the folder attribute, see if this helps.

Code: [Select]attrib +r c:\Wow6\*.* /S /D
attrib -r c:\Wow6\screenshots\*.* /S
attrib -r c:\Wow6\screenshots /D
pauseHello Foxidrive ... Thanks for helping with this... I will try this out when i get home from work later today. I believe I tried the /D alone as you have on the attrib -r c:\Wow6\screenshots /D and it complained that in order to use /D it had to be in conjunction to /S but not /D alone in which it required to be /S /D and not just /D, but you could use /S alone. The OS version is Windows XP Home SP3 btw in case there were any changes to attrib that I am not aware of between windows versions. Maybe I had a typo in the use of /D alone that caused that error message about /D having to be paired with /S. 



Code: [Select]attrib +r c:\Wow6\*.* /S /D
attrib -r c:\Wow6\screenshots\*.* /S
attrib -r c:\Wow6\screenshots /D
pause
Posted by: Squashman
Quote
Set a folder or a file to read only doesn't keep you from deleting it or replacing it.  You would need to set File Permissions for that.

hmmm.... so I would have to run as a user level account with the game client with restricted permissions then instead of admin while running the game, and your saying that read-only isnt enough to stop an update from changing the game client. 

I was thinking that with updates passing like file name data as updates to a game client that the read-only would stop alteration and removal unless the read-only attribute was removed which would then allow for the changes to take.

So what i really need to be doing is setting up a user account with restricted permissions that do not allow modification of the game installation at c:\wow6 and all sub folders and files contained within.  hmmm  I didnt think I was going to restrict it this far and though a simple attribute change for all files and folders would have been good enough. But i see where you are coming from now.A read-only file can't be deleted or overwritten. Attempting to delete a read-only file causes an Access Denied error. Attempting to overwrite it will also cause an Access Denied Error.

Windows Explorer however "helpfully" removes the attribute before performing the delete or copy operation and Read Only attributes do nothing in that instance.

However, for WoW, it's going to encounter an exception/Error if it tries to overwrite or delete the files. It is possible that the game is designed in the same way as Windows Explorer, and, on encountering an issue overwriting/replacing a file, will remove attributes that are causing it and try again. ACL's are probably a better route to go.

You should be able to right-click the folder and choose "Edit..." in the security tab, then you can "deny" the write permission for your account. This assumes- of course- that the game won't crash or show an error message and quit when it encounters an error trying to write those files.

Strange.  I just created a file.  Set to read only and then right clicked it and it deleted just fine.

and from the cmd line.
Code: [Select]H:\attrib>attrib foo1.txt
A    R       H:\attrib\foo1.txt

H:\attrib>del /f foo1.txt

H:\attrib>dir
 Volume in drive H is DATA
 Volume Serial Number is D2F3-49FA

 Directory of H:\attrib

02/13/2015  09:41 AM    <DIR>          .
02/13/2015  09:41 AM    <DIR>          ..
               0 File(s)              0 bytes
               2 Dir(s)  126,999,040,000 bytes free

H:\attrib> Code: [Select]D:\>mkdir test

D:\>cd test

D:\test>copy con testfile.txt
test file
^Z
        1 file(s) copied.

D:\test>attrib testfile.txt +r

D:\test>del testfile.txt
D:\test\testfile.txt
Access is denied.

D:\test>copy testfile.txt testfile2.txt
        1 file(s) copied.

D:\test>copy testfile2.txt testfile.txt
Overwrite testfile.txt? (Yes/No/All): y
Access is denied.
        0 file(s) copied.

The /f switch on del and erase forces deletion of readonly files by explicitly checking and removing the read only attribute before attempting to delete the file- at which point, the file being deleted is not read-only anymore.

copy doesn't have a similar switch, but xcopy does. (/R).

World of warcraft is not written in batch, of course. If it doesn't explicitly check for and remove the attribute, it will encounter an exception attempting to Delete it or open it to write new contents. Given that extra logic can remove the attribute fairly easily with something like SetFileAttributes(sFilename,GetFileAttributes(sFileName) & ~FILE_ATTRIBUTE_READONLY), some applications will just remove the flag. (Like Windows Explorer). ACLs are 'safer' (for Dave's purpose) because Applications are unlikely to go fiddling with those when they encounter Error 5.


Quote from: DaveLembke on February 13, 2015, 07:31:21 AM
I believe I tried the /D alone as you have on the attrib -r c:\Wow6\screenshots /D and it complained that in order to use /D it had to be in conjunction to /S

You are correct - try this with the extra /S and it should work but this may just be academic.

Code: [Select]attrib +r c:\Wow6\*.* /S /D
attrib -r c:\Wow6\screenshots\*.* /S
attrib -r c:\Wow6\screenshots /D /S
pause


Discussion

No Comment Found