Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Rename or change extension of all files in a folder
#1
The number of files and their extensions in the folder is variable; need to rename all file extensions to get .asp

D:\Harvest\02_GVP_IVRIntelPiloto (Piloto)\PGVITPL.19.04.10.1718 - Copy\file1.aspx 
D:\Harvest\02_GVP_IVRIntelPiloto (Piloto)\PGVITPL.19.04.10.1718 - Copy\file2.aspx 
D:\Harvest\02_GVP_IVRIntelPiloto (Piloto)\PGVITPL.19.04.10.1718 - Copy\file3.aspx 
D:\Harvest\02_GVP_IVRIntelPiloto (Piloto)\PGVITPL.19.04.10.1718 - Copy\file4.aspx 
D:\Harvest\02_GVP_IVRIntelPiloto (Piloto)\PGVITPL.19.04.10.1718 - Copy\file5.aspx 
D:\Harvest\02_GVP_IVRIntelPiloto (Piloto)\PGVITPL.19.04.10.1718 - Copy\file6.vox 
D:\Harvest\02_GVP_IVRIntelPiloto (Piloto)\PGVITPL.19.04.10.1718 - Copy\file7.vxml 
D:\Harvest\02_GVP_IVRIntelPiloto (Piloto)\PGVITPL.19.04.10.1718 - Copy\file8.vxml 
D:\Harvest\02_GVP_IVRIntelPiloto (Piloto)\PGVITPL.19.04.10.1718 - Copy\file9.vxml 
D:\Harvest\02_GVP_IVRIntelPiloto (Piloto)\PGVITPL.19.04.10.1718 - Copy\file10.vxml 
D:\Harvest\02_GVP_IVRIntelPiloto (Piloto)\PGVITPL.19.04.10.1718 - Copy\file11.vxml 
D:\Harvest\02_GVP_IVRIntelPiloto (Piloto)\PGVITPL.19.04.10.1718 - Copy\file12.vxml 

Please help.
#2
Code:
Copy      Help
lpstr s = dir(" D:\Harvest\02_GVP_IVRIntelPiloto (Piloto)\PGVITPL.19.04.10.1718 - Copy\*" 0)
str rawFile resultFile
int i

out
rep
    if(s = 0) break
    rawFile.format(" D:\Harvest\02_GVP_IVRIntelPiloto (Piloto)\PGVITPL.19.04.10.1718 - Copy\%s" s)
    i = find(rawFile ".")
    resultFile.format("%s.asp" rawFile.remove(i))
    rawFile.format(" D:\Harvest\02_GVP_IVRIntelPiloto (Piloto)\PGVITPL.19.04.10.1718 - Copy\%s" s)
    if(rawFile != resultFile)
        ren- rawFile resultFile
    s = dir

Maybe you must rename folder name without "."
#3
simpler method Enumerate the folder change the extension and rename
Code:
Copy      Help
Dir d
foreach(d "D:\Harvest\02_GVP_IVRIntelPiloto (Piloto)\PGVITPL.19.04.10.1718 - Copy\*.*" FE_Dir)
,str path=d.FullPath
,str fName=d.FileName
,fName.replacerx("\..+" "")
,fName+ ".asp"
,FileRename(path fName)
#4
Thank you very much guys Heart , I will use the Kevin method


Forum Jump:


Users browsing this thread: 1 Guest(s)