etc.

VBS 파일명 변경2

OJR 2008. 12. 23. 13:28
strPath = "."
Set fso = CreateObject("Scripting.FileSystemObject")
Set dir = fso.GetFolder(strPath)

For Each d In dir.SubFolders
 'If ( IsNumeric(d.name) And d.name="04" ) Then
 If ( IsNumeric(d.name) ) Then
  str = "이름변경된 파일" & vbCrLf
  Set subdir = fso.GetFolder(d.name)
  For Each sd In subdir.Files
   If( Mid(sd.name, 1, 2) = d.name ) Then
    
    htmlName = Mid(sd.Name, 1, InstrRev(sd.Name,".")-1)
    htmlNum = Right(htmlName, 2)
    
    'MsgBox Mid(sd.name, 1, 2) & " / " & htmlName & " / " & htmlNum
    Set subsubdir = fso.GetFolder(d.name & "/swf")
    For Each flash In subsubdir.Files
     fName = Mid(flash.Name, 1, InstrRev(flash.Name,".")-1)
     fNum = Right(fName, 2)
     fExt = Mid(flash.Name, InstrRev(flash.Name,".")+1)
     If( fNum = htmlNum And ( fExt = "fla" Or fExt = "swf" ) ) Then
      fso.CopyFile d.name&"/swf/"&flash.Name, d.name&"/swf/"&htmlName&"."&fExt
      'MsgBox sd.Name & " => " & htmlName&"."&fExt
      str = str & flash.Name & " => " & htmlName&"."&fExt & vbCrlf
     End If     
    Next
   End If
  Next
  MsgBox str
 End If
Next

요구사항
  다 개발되어진 것에서 파일명을 자신이 원하는 형태로 변경해 달라.
  html 파일명과  swf파일명을 일치시켜 달라는 것이다.
  vbs로 해 보았다.  예전것을 응용해서 되긴 된다.

vbs 문법 참고
http://www.mna.hkr.se/caspdoc/html/vbscript_statements.htm



반응형

'etc.' 카테고리의 다른 글

제로보드 xe 설치조건 확인 db 불가능 일때  (0) 2012.07.29
짜증나는 "xvidcore.dll not found" 경고창 뜰 때 - 오류 해결 방법  (0) 2009.04.03
VBS 파일명 변경  (0) 2008.12.08
정보보안전문가  (0) 2008.12.03
믹시  (0) 2008.11.19