Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 267
  • Last Modified:

Remove all file extensions from all files in subdirectories

This is a carry one from - http://www.experts-exchange.com/Programming/Q_20801502.html - what I had not though about was I have many subdirectories under the main and each have some tif files that get added. What I would like to make the example given to me http://www.experts-exchange.com/Programming/Q_20801502.html here auto look in all the subdirectories as the names of them will change or be added to. So I just select the mail directory and it will go through it and all subdirectories and take the file extensions off. Any and all files under the main directory will be *.tif files.
0
Scan_25
Asked:
Scan_25
1 Solution
 
bhagyeshtCommented:
change ur folder name
the following is a vbscript code
copy and paste it into a vbs file



set WshShell = WScript.CreateObject("WScript.Shell")
strStartup = "D:\Temp\rena"
Set fso = CreateObject("Scripting.FileSystemObject")
Set f = fso.GetFolder(strStartup)
process(f)
renameFiles(f)

function process(objFolder)
      for each x in objFolder.subfolders
            renameFiles x
            process x
      next
end function


function renameFiles (objfolder)
      for each y in objfolder.files
            if right(y.name,4)=".tif" then
                  y.move left(y.path, len(y.path)-4)
'                  msgbox left(y.name,len(y.name)-4)
            end if
      next
end function
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now