|
Add a file extension directory wide
| Language: |
ASP |
   
Rated by 3 Users
1 Star = Horrible 5 Stars = Perfect
Rate Code Now
|
| Posted By: |
blake |
| Author Website: |
Differences between ASP and PHP |
| Posted On: |
7/1/2007 |
| Code Views: |
1559 |
This code will add a file extension to every file in a given directory. Make sure you have given the directory appropriate permissions before running this code.
|
<%
SUB MyBatchAddExt(My_Path, My_EXT) '****************************** ' www.yourwebcode.com '****************************** 'Purpose: Ads an extension to the end of all files... 'Input: ("path/",".txt") 'Output: will add a .txt to the end of all files in the path/ directory ' 'To use this sub-routine: ' MyBatchAddExt "path/",".txt" ' 'Make sure you have appropriate file permissions in the directory
DIM My_FSO, My_FOLDER, My_Temp
SET My_FSO = CreateObject("Scripting.FileSystemObject") SET My_FOLDER = My_FSO.GetFolder(Server.MapPath(My_PATH))
FOR EACH My_Temp IN My_FOLDER.Files My_FSO.MoveFile My_Temp, My_Temp & My_EXT NEXT
SET My_FOLDER = Nothing SET My_FSO = Nothing
END SUB
%>
View code in Textarea
This code has not been tested by Your WebCode. Use it at your own risk.
Please report any copyright violations.
|
|