Delete file from Server

Hi all,
I'm using WPut and WGet to upload and download files to a FTP Server but need some Access VBA code to delete a file from there please.
Maybe some FTP Shell command?

Pierre KAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Kanti PrasadCommented:

You can use
delete  filename.ext
mdelete *.ext
Pierre KAuthor Commented:
@Kanti - thanks for the reply.
Could you provide more info as to how I would implement this in Access VBA please?
As explained the file I need to delete resides on my Web Server.
So I need some FTP command to delete the specific file
Kanti PrasadCommented:

The one I gave you is to run it as a FTP command. Try it and if it works just put it as a .bat file and run it.
Protecting & Securing Your Critical Data

Considering 93 percent of companies file for bankruptcy within 12 months of a disaster that blocked access to their data for 10 days or more, planning for the worst is just smart business. Learn how Acronis Backup integrates security at every stage

Pierre KAuthor Commented:
@Kanti - I created a bat file with ref to the http path to the file but I'm getting an error stating that the 'delete' or 'mdelete' command doesn't exist
Kanti PrasadCommented:

Initially run just with the delete  on that server then we can look giving the path name.

FTP> prompt
FTP> delete filename*.ext  |yes
Pierre KAuthor Commented:
@Kanti - OK I understand but I need the full code to login and do the delete from within VBA code.
I have an idea how to do it via Command Prompt but not sure how to do it all the way with VBA code.
Sorry - hope that make sense?
Kanti PrasadCommented:

Just record a macro in xls and copy this

Sub macro()
Kill "C:\yourdirectorypath\*.ext"
End Sub
Gustav BrockCIOCommented:
There is no WDel for Windows, but you can run a script for the FTP utility:

@echo off
>file.txt echo open
>>file.txt echo username
>>file.txt echo password
>>file.txt echo cd  /directory
>>file.txt echo binary
>>file.txt echo del %1
>>file.txt echo disconnect
>>file.txt echo bye

ftp -i -s:"file.txt"
del "file.txt"

Open in new window

Pierre KAuthor Commented:
@Gustav - Ahhh - that sounds far more like the code I need.
I would only be able to test it in the morning (our time).
Only need to figure out how to put it in a Function or VBA script - would be nice if you could help with that...
Gustav BrockCIOCommented:
Here's an example:

Upload file via FTP from VBA


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Pierre KAuthor Commented:
@Gustav - Thanks a lot - worked like a dream!
Gustav BrockCIOCommented:
You are welcome!

It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Access

From novice to tech pro — start learning today.