Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @echo off
- (
- Echo. Option Explicit
- Echo. Dim StdIn: Set StdIn = WScript.StdIn
- Echo. Dim StdOut: Set StdOut = WScript.StdOut
- Echo. Dim fso: Set fso = CreateObject("Scripting.FileSystemObject"^)
- Echo. Dim FilesRenamed: FilesRenamed = 0
- Echo. Dim FilesSkipped: FilesSkipped = 0
- Echo. Dim FoldersRenamed: FoldersRenamed = 0
- Echo. Dim FoldersSkipped: FoldersSkipped = 0
- Echo. Main
- Echo. Sub Main
- Echo. Dim CurrentFolder: Set CurrentFolder = fso.GetFolder("."^)
- Echo. StdOut.WriteLine "Atenção: Todos os arquivos e subdiretórios dentro desse diretório"
- Echo. StdOut.WriteLine CurrentFolder.Path
- Echo. StdOut.WriteLine "E subdiretórios será renomeado para maiúsculas."
- Echo. If Not PromptYesNo("Continuar ?"^) Then Exit Sub
- Echo. ProcessFolder CurrentFolder
- Echo. StdOut.WriteLine FilesRenamed ^& " Arquivos e " ^& FoldersRenamed ^& " Pastas renomeadas para maiúsculas."
- Echo. StdOut.WriteLine FilesSkipped ^& " Arquivos e " ^& FoldersSkipped ^& " Pastas já estavam maiúsculas."
- Echo. End Sub
- Echo. Sub ProcessFolder (ByVal Folder^)
- Echo. Dim Files: Set Files = Folder.Files
- Echo. Dim File
- Echo. For Each File In Files
- Echo. If File.Name ^<^> LCase(File.Name^) Then
- Echo. File.Move UCase(File.Path^)
- Echo. FilesRenamed = FilesRenamed + 1
- Echo. Else
- Echo. FilesSkipped = FilesSkipped + 1
- Echo. End If
- Echo. Next
- Echo. Dim SubFolders: Set SubFolders = Folder.SubFolders
- Echo. Dim SubFolder
- Echo. For Each SubFolder In SubFolders
- Echo. If SubFolder.Name ^<^> LCase(SubFolder.Name^) Then
- Echo. SubFolder.Move UCase(SubFolder.Path^)
- Echo. FoldersRenamed = FoldersRenamed + 1
- Echo. Else
- Echo. FoldersSkipped = FoldersSkipped + 1
- Echo. End If
- Echo. ProcessFolder SubFolder
- Echo. Next
- Echo. End Sub
- Echo. Function PromptYesNo (ByVal PromptText^)
- Echo. Do
- Echo. StdOut.Write PromptText ^& " (S/N) - "
- Echo. Dim s: s = StdIn.ReadLine(^)
- Echo. Select Case LCase(Trim(s^)^)
- Echo. Case "N","n","nao" PromptYesNo = False: Exit Function
- Echo. Case "S","s","Sim" PromptYesNo = True: Exit Function
- Echo. End Select
- Echo. StdOut.WriteLine "Invalid input."
- Echo. Loop
- Echo. End Function
- )>File.vbs
- CSCRIPT //NOLOGO File.vbs
- PAUSE
Advertisement
Add Comment
Please, Sign In to add comment