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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Removing contents of remote folder

Status
Not open for further replies.

Glasgow

IS-IT--Management
Jul 30, 2001
1,669
GB
I have been using the shell folder object to copy files from a local folder to a remote one using ftp and the CopyHere method. However, I would like to be able to remove certain files from the remote folder first. The closest I have come is the code below but the InvokeVerb ("delete") line triggers a confirmation prompt which I don't want. Is there another way of doing this?
Code:
  Dim FtpFolder As Folder, LocFolder As Folder, myShell As Shell
  Set myShell = New Shell
  Set LocFolder = myShell.NameSpace(LocPath)
  Set FtpFolder = myShell.NameSpace(FtpPath)
  Dim FilItm As FolderItem
  For Each FilItm In FtpFolder.Items
    MsgBox FilItm.Name
    FilItm.InvokeVerb "delete"
  Next
  FtpFolder.CopyHere LocFolder.Items, FOF_NOCONFIRMATION
  Set FtpFolder = Nothing
  Set myShell = Nothing
 
Glasgow,

you may be able to use -

docmd.setwarnings warningsoff before your loop then docmd.setwarnings warningon after the loop to solve your problem.

Regards
Max
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top