INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Jobs

Visual Basic Script .vbs - uses Browse Dialog to rename subfolders in parent folder...

Visual Basic Script .vbs - uses Browse Dialog to rename subfolders in parent folder...

Visual Basic Script .vbs - uses Browse Dialog to rename subfolders in parent folder...

(OP)
Hey I need help cleaning up my script.
Is it in the right forum btw????

CODE --> VBS

´╗┐Function FolderDlg  
 Const MY_COMPUTER = &H11&  
 Const WINDOW_HANDLE = 0  
 Const OPTIONS = 0  
 Set objShell = CreateObject("Shell.Application")  
 Set objFolder = objShell.Namespace(MY_COMPUTER)  
 Set objFolderItem = objFolder.Self  
 strPath = objFolderItem.Path  
 Set objShell = CreateObject("Shell.Application")  
 Set objFolder = objShell.BrowseForFolder (WINDOW_HANDLE, "Select a folder:", OPTIONS, strPath)  
 If objFolder Is Nothing Then  
 Wscript.Quit  
 End If  
 Set objFolderItem = objFolder.Self  
 objPath = objFolderItem.Path  
 FolderDlg = objPath  
 End Function  
 
 Function WeighFolder (ByVal strFolder)  
 Dim objFSO  
 Dim ParentFld  
 Dim ParentSz  
 Set objFSO = CreateObject("scripting.FileSystemObject")  
 Set ParentFld = objFSO.GetFolder (strFolder)  
 ParentSz = Round (ParentFld.Size /1024/1024,2) & " MB"  
 WeighFolder = ParentSz   
 End Function  
 
 Function CountFiles (ByVal strFolder)  
 Dim objFSO  
 Dim ParentFld  
 Dim SubFld  
 Dim IntCount  
 Set objFSO = CreateObject("scripting.FileSystemObject")  
 Set ParentFld = objFSO.GetFolder (strFolder)  
 IntCount = ParentFld.Files.Count  
 For Each SubFld In ParentFld.SubFolders  
 IntCount = IntCount + CountFiles(SubFld.Path) 
 Next  
 CountFiles = IntCount  
 End Function  
 
 RenameSubfolders (FolderDlg)  
 
 Function RenameSubfolders (ByVal strFolder)  
 Dim objFSO  
 Dim ParentFldr  
 Dim SubFldrs  
 Dim SubFldr  
 Set objFSO = CreateObject("Scripting.FileSystemObject")  
 Set ParentFldr = objFSO.GetFolder(strFolder)  
 Set SubFldrs = ParentFldr.Subfolders  
 For Each SubFldr in SubFldrs  
 SubFldr.Name = SubFldr.Name & " [Files - " & CountFiles (SubFldr) & "; Size - " & WeighFolder (SubFldr) & "]"  
 Next  
 End Function 

RE: Visual Basic Script .vbs - uses Browse Dialog to rename subfolders in parent folder...

(OP)
Yo what's up?!
No one helping me haha.
That sucks

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Resources

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close