Delete Folder-->SubFolders--->Files..!

  • Thread starter Thread starter ALESSANDRO Baraldi
  • Start date Start date
A

ALESSANDRO Baraldi

Hi.
I need to Delete all MainFolder contents if is possible without cicle
through the
main folder....!

Have you some idea...!

ManyThanks

Alessandro(IT)
 
ALESSANDRO Baraldi said:
Hi.
I need to Delete all MainFolder contents if is possible without cicle
through the
main folder....!

Have you some idea...!

ManyThanks

Alessandro(IT)

If Windows Scripting is installed on the machine, I think using the
FileSystemObject's DeleteFolder method will do what you want.
 
Dirk Goldgar said:
If Windows Scripting is installed on the machine, I think using the
FileSystemObject's DeleteFolder method will do what you want.

--
Dirk Goldgar, MS Access MVP
www.datagnostics.com

(please reply to the newsgroup)

I never use it can you tell me how can i do...!
Now i try with API shell32 with Trash Simulator, work good, bat
i retrive Error if I have Folder-ManySubFolder-ManyFiles ....!
I'm using Access and I'm Linking BE in SubFolder with BE(switch) sistem.
I really think that the problem it's about the Fast Deleting.
Before Delete i remove Link, and all Immage.Picture connection, but
nothing to do.....!
If i delete each Files in each SubFolder with Kill and RemDir all OK....!

Sorry about my English very bad....!

Thanks.

Alessandro.(IT)
 
ALESSANDRO Baraldi said:
I never use it can you tell me how can i do...!
Now i try with API shell32 with Trash Simulator, work good, bat
i retrive Error if I have Folder-ManySubFolder-ManyFiles ....!
I'm using Access and I'm Linking BE in SubFolder with BE(switch)
sistem. I really think that the problem it's about the Fast Deleting.
Before Delete i remove Link, and all Immage.Picture connection, but
nothing to do.....!
If i delete each Files in each SubFolder with Kill and RemDir all
OK....!

I don't know for sure that this method will avoid the problem you're
having but this works in my simple test:

'---- start of example code ----
Sub DeleteFolder(FolderPath As String)

Dim fs As Object

Set fs = CreateObject("Scripting.FileSystemObject")

fs.DeleteFolder FolderPath

Set fs = Nothing

End Sub

'---- end of example code ----

Then you could call it like this:

DeleteFolder "C:\Temp\DoomedFolder"
Sorry about my English very bad....!

It's much better than my Italian (which is non-existent).
 
Dirk Goldgar said:
I don't know for sure that this method will avoid the problem you're
having but this works in my simple test:

'---- start of example code ----
Sub DeleteFolder(FolderPath As String)

Dim fs As Object

Set fs = CreateObject("Scripting.FileSystemObject")

fs.DeleteFolder FolderPath

Set fs = Nothing

End Sub

'---- end of example code ----

Then you could call it like this:

DeleteFolder "C:\Temp\DoomedFolder"


It's much better than my Italian (which is non-existent).


I try, also with this whay but i have the same error...!
Now i think that in my application i can have some other
Links to this folder....!
Thanks for your Help.

@Alex.
 
Alessandro IT said:
I try, also with this whay but i have the same error...!
Now i think that in my application i can have some other
Links to this folder....!
Thanks for your Help.

@Alex.

That could be. I can't tell from what you've written exactly what error
you are getting, but it may be something you're going to have to track
down yourself. I suppose you could try using Explorer to attempt to
delete all the files and folders yourself manually, with the application
in the same state as it would be in if you were calling DeleteFolder().
Then you might see a message at least telling you what file or folder is
causing the problem.
 
Dirk Goldgar said:
That could be. I can't tell from what you've written exactly what error
you are getting, but it may be something you're going to have to track
down yourself. I suppose you could try using Explorer to attempt to
delete all the files and folders yourself manually, with the application
in the same state as it would be in if you were calling DeleteFolder().
Then you might see a message at least telling you what file or folder is
causing the problem.

--
Dirk Goldgar, MS Access MVP
www.datagnostics.com

(please reply to the newsgroup)


I just do it, but No ERROR, i can Delet All withOut any message.
If i do it by VBA ........! ;-)

This is strange, but i'll probably must search some Bugs i my
Application...!

Bye.
Alessandro(IT)
 
Back
Top