Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Rename files on client machine

Status
Not open for further replies.

mydisney

Programmer
May 7, 2007
55
US
After doing a ftp and mget (download multiple files) I need to rename files that were downloaded. I have a script that works on my local machine (see below) but does not work on the client machine which is a Unix box. The error I get is that specified path was not found. How do I specify a path on a Unix box that vb script will accept?


'Rename .asc file extensions to .bak after ftp download and move files to backup folder
Dim filesys, file, folderName, objFile, folderObj, fileColl, objRegExp, newFile
Set filesys = CreateObject("Scripting.FileSystemObject")
folderName = "c:\mylocalfolder\mylocafiles\"
Set folderObj = filesys.GetFolder(folderName)
Set fileColl = folderObj.Files
Set objRegExp = New RegExp
objRegExp.Pattern = "^(t)(.*\.)txt$"
objRegExp.IgnoreCase = True
For Each objFile In fileColl
If objRegExp.Test(objFile.Name) Then
newFile = objRegExp.Replace(objFile.Name, "$1$2bak")
filesys.MoveFile objFile, folderName & "backup\" & newFile
End If
Next
 
If you are using Samba to talk to Unix, then there shouldn't be any problem. You could try changing all \ to /

Have you tried the script from windows to windows: not just locally but to another windows box. You probably need to set up the ftp server using IIS first.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top