ArcPad Scripting Object Model
RenameFile Method
See Also  Example  Send comments on this topic.
ExistingFileName
Required. A String that represents the existing file name inside the archive.
NewFileName
Required. A String that represents the new file name inside the archive.
Archive Object : RenameFile Method

Glossary Item Box

Description

Renames the specified file inside the archive.

Syntax

object.RenameFile ( ExistingFileName, NewFileName )

Parameters

ExistingFileName
Required. A String that represents the existing file name inside the archive.
NewFileName
Required. A String that represents the new file name inside the archive.

Return Type

Boolean

Example

RenameFile Example
Renames a file in a ZIP Archive.
RenameFile Example (VBScript)Copy Code
Sub RenameFile(strArchiveFile, strCompressedFile, strNewName)
      ' Open the ZIP archive
      Dim pArchive
      Set pArchive = Application.CreateAppObject("Archive")
      If (Not pArchive.Open(strArchiveFile)) Then Exit Sub
      
      ' Rename the file
      Dim blnResult
      blnResult = pArchive.RenameFile(strCompressedFile, strNewName)
      
      ' Close the ZIP archive
      pArchive.Close()

      ' Display the results
      If (Not blnResult) Then
            Application.MessageBox "Failed to rename file.", vbCritical, "Error"
      Else
            Application.MessageBox strCompressedFile & " renamed to " & strNewName, vbInformation, "Success"
      End If
End Sub

See Also

© 2013 All Rights Reserved.