1
특정 문자열이있는 파일을 검색하고 이름을 바꾸는 vbs 스크립트를 작성하는 방법을 설명해 주실 수 있습니까?특정 문자열이있는 폴더의 파일 이름 바꾸기 vbs
내가 C에서 검색 할 \ 테스트 : 예를 들어
, 나는 폴더 C가 있다고 가정 ... 단어 존과 단어 데이브 말과 함께 교체로 모든 파일에 대해 \ 테스트를예 내용이었다 :
john_list.txt auto.john.doc 스크립트 후
:
dave_list.txt
당신이 도와 줄 수 auto.dave.doc?감사합니다.
해결책 :
Dim sName
Dim fso
Dim fol
' create the filesystem object
Set fso = WScript.CreateObject("Scripting.FileSystemObject")
' get current folder
Set fol = fso.GetFolder("c:\TEST")
' go thru each files in the folder
For Each fil In fol.Files
' check if the file name contains underscore
If InStr(1, fil.Name, "john") <> 0 Then
' replace underscore with space
sName = Replace(fil.Name, "john", "dave")
' rename the file
fil.Name = sName
End If
Next
' echo the job is completed
WScript.Echo "Completed!"
귀하의 의견은 더 이상 거짓말을하지 않습니다 (그리고 - 선택 사항 - 당신은 "조니"처리 방법 공개) 나는 즉시 upvote에 있습니다. –
'댓글이 더 이상 거짓말을하지 않는다'는 것은 무엇을 의미합니까? 나는 무엇에 대해 거짓말을 했습니까? – Woodstock
당신은 밑줄과 공백을 제외하고는 존스와 데이브를 다루지 않습니다. –