ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   DELETING FILES FROM A FOLDER WITH SPECIFIC EXTENSION (https://www.excelbanter.com/excel-programming/299789-deleting-files-folder-specific-extension.html)

R v Deursen

DELETING FILES FROM A FOLDER WITH SPECIFIC EXTENSION
 
I have a folder that contains generated .pdf files.
In the same folder there is after .pdf creation always a
second file of each pdf with the extension .apd.
I need a VB script that automatically searches for files
with the extension .apd in the same folder as the pdf,s
and deletes them.

There is already a peace of the script, but it is totally
wrong or incomplete.

Thank you so much.

Dim objFSO
Set objFSO = CreateObject
("Scripting.FileSystemObject")
objFSO.DeleteFile "G:\page
store\CERT_TIJDSCHRIFTEN_NL\*.apd"

Set objFSO = Nothing
Wscript.Quit


keepITcool

DELETING FILES FROM A FOLDER WITH SPECIFIC EXTENSION
 
Hi,

why don't you use simple DIR and KILL?
see vba help for DIR function..
there's a good example there on how to loop....
the KILL explains itself...



< email : keepitcool chello nl (with @ and .)
< homepage: http://members.chello.nl/keepitcool


"R v Deursen" wrote:

I have a folder that contains generated .pdf files.
In the same folder there is after .pdf creation always a
second file of each pdf with the extension .apd.
I need a VB script that automatically searches for files
with the extension .apd in the same folder as the pdf,s
and deletes them.

There is already a peace of the script, but it is totally
wrong or incomplete.

Thank you so much.

Dim objFSO
Set objFSO = CreateObject
("Scripting.FileSystemObject")
objFSO.DeleteFile "G:\page
store\CERT_TIJDSCHRIFTEN_NL\*.apd"

Set objFSO = Nothing
Wscript.Quit





All times are GMT +1. The time now is 09:58 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com