Computer Forums

Member Login

Remember Me? Sign Up! | Forgot Password
 
Slogan
 
Computer Forums > Programmers Lounge > Programming Discussions » vbscript to find Read-Only files
Closed Thread
Old 01-26-2006, 03:55 PM   #1 (permalink)
 
Newb Techie

Join Date: Sep 2005

Posts: 19

stubornallstar

Send a message via AIM to stubornallstar
Default vbscript to find Read-Only files

I am looking for a vbscript that would be able to go through a filesystem and locate files/folders set as Read-Only and change those to not Read-only. Any suggestions?
ty
stubornallstar is offline  
Old 01-26-2006, 04:11 PM   #2 (permalink)
 
Newb Techie

Join Date: Sep 2005

Posts: 19

stubornallstar

Send a message via AIM to stubornallstar
Default

I found some code that is aiming in the right direction. is there any vb pros out there that can help me shape this more into what im looking for?
Description
Demonstration script that checks to see if a file is read-only and, if it is not, marks it as read-only. Script must be run on the local computer.

Script Code

Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFile = objFSO.GetFile("C:\FSO\TestScript.vbs")
If objFile.Attributes = objFile.Attributes AND 1 Then
objFile.Attributes = objFile.Attributes XOR 1
End If
stubornallstar is offline  
Old 01-26-2006, 04:13 PM   #3 (permalink)
 
Newb Techie

Join Date: Sep 2005

Posts: 19

stubornallstar

Send a message via AIM to stubornallstar
Default

i need the file to be marked as NOT read-only. and id like it if it can run an entire file system at once. SUGGESSTIONS PLEASE : )
ty
stubornallstar is offline  
Old 01-26-2006, 11:47 PM   #4 (permalink)
office politics's Avatar
 
It's all just 1s and 0s

Join Date: Jan 2004

Location: in the lab

Posts: 4,425

office politics will become famous soon enough

Default

Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFile = objFSO.GetFile("C:\FSO\TestScript.vbs")
If objFile.Attributes = objFile.Attributes AND 1 Then
objFile.Attributes = objFile.Attributes AND 0
End If

change xor 1 to and 0 for read/write permission
office politics is offline  
 
Closed Thread

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On