473,499 Members | 1,909 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Unable to delete folder

Hi,

I have the following code to select a folder and then delete it. I keep
getting a Path/File error on the line that deletes the actual folder. The
line before that line deletes the files in the folder but I get the error
message when the procedure attempts to delete the folder selected in the
BrowseforFolderbyPath function.

How can I get it to delete the folder that the user has selected in the
Browse for Folder dialog?
Thanks,
Anthony
************************ BEGIN CODE SNIPPET ******************************

ArchiveFolder = BrowseForFolderByPath(ProgramPath)

'check if user has clicked the Cancel button.
If ArchiveFolder = vbNullString Then

Exit Sub

End If

'check if the selected folder is under the program folder.
If Left(ArchiveFolder, Len(ArchiveFolder) - 5) <ProgramPath Or
(Right(ArchiveFolder, 4)) Like "*[!0-9]*" Then

MsgBox "That is an invalid Archive folder." & Chr$(13) & Chr$(13)
& _
"Archives are located in the " & ProgramPath & " folder." & Chr$
(13) & Chr$(13) & _
"Please select an archive in the " & ProgramPath & " folder.",
vbOKOnly + vbInformation, "Invalid Archive Folder."

Exit Sub

End If

strDeleteQuestion = MsgBox("Do you really want to delete the " &
ArchiveFolder & " archive?", vbYesNo + vbQuestion, "Delete Archive.")

If strDeleteQuestion = vbYes Then

'delete all files in the selected archive folder.
Kill ArchiveFolder & "\*.*" <----------------
- this line works.

Delete_Destination = ArchiveFolder & "\" <------ this
line fails.

RmDir Delete_Destination

MsgBox "The Archive has been successfully deleted.", vbOKOnly
+ VbInformation, "Success!"

End If

**************************** END CODE SNIPPET
********************************************

This is the function I'm using for the BrowseforfolderbyPath:
Public Function BrowseForFolderByPath(sSelPath As String) As String

Dim BI As BROWSEINFO
Dim pidl As Long
Dim lpSelPath As Long
Dim spath As String * MAX_PATH

With BI
.hOwner = Me.hwnd
.pidlRoot = 0
If RestoreArchive = True Then
.lpszTitle = "Archives are located under the application's folder." &
Chr$(13) & "What Archive do you want to Restore?"
Else
.lpszTitle = "Archives are located under the application's folder." &
Chr$(13) & "What Archive do you want to Delete?"
End If

.lpfn = FARPROCl(AddressOf BrowseCallbackProcStr)

lpSelPath = LocalAlloc(LPTR, Len(sSelPath) + 1)
CopyMemory ByVal lpSelPath, ByVal sSelPath, Len(sSelPath) + 1
.lParam = lpSelPath

End With

pidl = SHBrowseForFolder(BI)

If pidl Then

If SHGetPathFromIDList(pidl, spath) Then
BrowseForFolderByPath = Left$(spath, InStr(spath, vbNullChar) - 1)
End If

Call CoTaskMemFree(pidl)

End If

Call LocalFree(lpSelPath)

End Function

Public Function IsWinNT() As Boolean

#If Win32 Then

Dim OSV As OSVERSIONINFO

OSV.OSVSize = Len(OSV)

'API returns 1 if a successful call
If GetVersionEx(OSV) = 1 Then

'PlatformId contains a value representing
'the OS, so if it's VER_PLATFORM_WIN32_NT,
'return true
IsWinNT = OSV.PlatformID = VER_PLATFORM_WIN32_NT
End If

#End If

End Function

--
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/For...ccess/200705/1

May 21 '07 #1
24 7509
Just realised that I highlighted the incorrect line. The line thar is failing
is:

Â*RmDir Delete_Destination

Is it failing because the folder to be deleted is still "locked" by the
browseforfolderbypath function?


biganthony wrote:
>Hi,

I have the following code to select a folder and then delete it. I keep
getting a Path/File error on the line that deletes the actual folder. The
line before that line deletes the files in the folder but I get the error
message when the procedure attempts to delete the folder selected in the
BrowseforFolderbyPath function.

How can I get it to delete the folder that the user has selected in the
Browse for Folder dialog?

Thanks,
Anthony

************************ BEGIN CODE SNIPPET ******************************

ArchiveFolder = BrowseForFolderByPath(ProgramPath)

'check if user has clicked the Cancel button.
If ArchiveFolder = vbNullString Then

Exit Sub

End If

'check if the selected folder is under the program folder.
If Left(ArchiveFolder, Len(ArchiveFolder) - 5) <ProgramPath Or
(Right(ArchiveFolder, 4)) Like "*[!0-9]*" Then

MsgBox "That is an invalid Archive folder." & Chr$(13) & Chr$(13)
& _
"Archives are located in the " & ProgramPath & " folder." & Chr$
(13) & Chr$(13) & _
"Please select an archive in the " & ProgramPath & " folder.",
vbOKOnly + vbInformation, "Invalid Archive Folder."

Exit Sub

End If

strDeleteQuestion = MsgBox("Do you really want to delete the " &
ArchiveFolder & " archive?", vbYesNo + vbQuestion, "Delete Archive.")

If strDeleteQuestion = vbYes Then

'delete all files in the selected archive folder.

Kill ArchiveFolder & "\*.*" <----------------
- this line works.

Delete_Destination = ArchiveFolder & "\" <------ this
line fails.

RmDir Delete_Destination

MsgBox "The Archive has been successfully deleted.", vbOKOnly
+ VbInformation, "Success!"

End If

**************************** END CODE SNIPPET
********************************************

This is the function I'm using for the BrowseforfolderbyPath:

Public Function BrowseForFolderByPath(sSelPath As String) As String

Dim BI As BROWSEINFO
Dim pidl As Long
Dim lpSelPath As Long
Dim spath As String * MAX_PATH

With BI
.hOwner = Me.hwnd
.pidlRoot = 0
If RestoreArchive = True Then
.lpszTitle = "Archives are located under the application's folder." &
Chr$(13) & "What Archive do you want to Restore?"
Else
.lpszTitle = "Archives are located under the application's folder." &
Chr$(13) & "What Archive do you want to Delete?"
End If

.lpfn = FARPROCl(AddressOf BrowseCallbackProcStr)

lpSelPath = LocalAlloc(LPTR, Len(sSelPath) + 1)
CopyMemory ByVal lpSelPath, ByVal sSelPath, Len(sSelPath) + 1
.lParam = lpSelPath

End With

pidl = SHBrowseForFolder(BI)

If pidl Then

If SHGetPathFromIDList(pidl, spath) Then
BrowseForFolderByPath = Left$(spath, InStr(spath, vbNullChar) - 1)
End If

Call CoTaskMemFree(pidl)

End If

Call LocalFree(lpSelPath)

End Function

Public Function IsWinNT() As Boolean

#If Win32 Then

Dim OSV As OSVERSIONINFO

OSV.OSVSize = Len(OSV)

'API returns 1 if a successful call
If GetVersionEx(OSV) = 1 Then

'PlatformId contains a value representing
'the OS, so if it's VER_PLATFORM_WIN32_NT,
'return true
IsWinNT = OSV.PlatformID = VER_PLATFORM_WIN32_NT
End If

#End If

End Function
--
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/For...ccess/200705/1

May 21 '07 #2
biganthony via AccessMonster.com wrote:
Just realised that I highlighted the incorrect line. The line thar is failing
is:

RmDir Delete_Destination

Is it failing because the folder to be deleted is still "locked" by the
browseforfolderbypath function?
Doubtful.

Do you have rights to delete the folder?

Prior to deleting, do something like
msgbox Delete_Destination
Does that look correct?

Do you get an error message? If so, what is the error number and error
message?

>

biganthony wrote:
>>Hi,

I have the following code to select a folder and then delete it. I keep
getting a Path/File error on the line that deletes the actual folder. The
line before that line deletes the files in the folder but I get the error
message when the procedure attempts to delete the folder selected in the
BrowseforFolderbyPath function.

How can I get it to delete the folder that the user has selected in the
Browse for Folder dialog?

Thanks,
Anthony

************************ BEGIN CODE SNIPPET ******************************

ArchiveFolder = BrowseForFolderByPath(ProgramPath)

'check if user has clicked the Cancel button.
If ArchiveFolder = vbNullString Then

Exit Sub

End If

'check if the selected folder is under the program folder.
If Left(ArchiveFolder, Len(ArchiveFolder) - 5) <ProgramPath Or
(Right(ArchiveFolder, 4)) Like "*[!0-9]*" Then

MsgBox "That is an invalid Archive folder." & Chr$(13) & Chr$(13)
& _
"Archives are located in the " & ProgramPath & " folder." & Chr$
(13) & Chr$(13) & _
"Please select an archive in the " & ProgramPath & " folder.",
vbOKOnly + vbInformation, "Invalid Archive Folder."

Exit Sub

End If

strDeleteQuestion = MsgBox("Do you really want to delete the " &
ArchiveFolder & " archive?", vbYesNo + vbQuestion, "Delete Archive.")

If strDeleteQuestion = vbYes Then

'delete all files in the selected archive folder.

Kill ArchiveFolder & "\*.*" <----------------
- this line works.

Delete_Destination = ArchiveFolder & "\" <------ this
line fails.

RmDir Delete_Destination

MsgBox "The Archive has been successfully deleted.", vbOKOnly
+ VbInformation, "Success!"

End If

**************************** END CODE SNIPPET
********************************************

This is the function I'm using for the BrowseforfolderbyPath:

Public Function BrowseForFolderByPath(sSelPath As String) As String

Dim BI As BROWSEINFO
Dim pidl As Long
Dim lpSelPath As Long
Dim spath As String * MAX_PATH

With BI
.hOwner = Me.hwnd
.pidlRoot = 0
If RestoreArchive = True Then
.lpszTitle = "Archives are located under the application's folder." &
Chr$(13) & "What Archive do you want to Restore?"
Else
.lpszTitle = "Archives are located under the application's folder." &
Chr$(13) & "What Archive do you want to Delete?"
End If

.lpfn = FARPROCl(AddressOf BrowseCallbackProcStr)

lpSelPath = LocalAlloc(LPTR, Len(sSelPath) + 1)
CopyMemory ByVal lpSelPath, ByVal sSelPath, Len(sSelPath) + 1
.lParam = lpSelPath

End With

pidl = SHBrowseForFolder(BI)

If pidl Then

If SHGetPathFromIDList(pidl, spath) Then
BrowseForFolderByPath = Left$(spath, InStr(spath, vbNullChar) - 1)
End If

Call CoTaskMemFree(pidl)

End If

Call LocalFree(lpSelPath)

End Function

Public Function IsWinNT() As Boolean

#If Win32 Then

Dim OSV As OSVERSIONINFO

OSV.OSVSize = Len(OSV)

'API returns 1 if a successful call
If GetVersionEx(OSV) = 1 Then

'PlatformId contains a value representing
'the OS, so if it's VER_PLATFORM_WIN32_NT,
'return true
IsWinNT = OSV.PlatformID = VER_PLATFORM_WIN32_NT
End If

#End If

End Function

May 21 '07 #3
Salad,

Thanks for replying.

First, I have full rights to the folder - it is a local folder.
Second, the error message is: "Path/File Access Error." and the error number
is 75.
Thirdly, I did this: msgbox Delete_Destination and the folder appears
correctly.

The strange thing is the code works on my desktop at home. That computer is
running Win XP x64 and Office 2003 Professional. When I run it on my laptop I
get the error. The laptop is running Win XP Pro and Office 2003 Professional.
Besides that, I cannot work out any other differences to help explain why it
won't work on my laptop.

Thanks again,
Anthony


salad wrote:
>Just realised that I highlighted the incorrect line. The line thar is failing
is:
[quoted text clipped - 3 lines]
>Is it failing because the folder to be deleted is still "locked" by the
browseforfolderbypath function?

Doubtful.

Do you have rights to delete the folder?

Prior to deleting, do something like
msgbox Delete_Destination
Does that look correct?

Do you get an error message? If so, what is the error number and error
message?
>>>Hi,
[quoted text clipped - 123 lines]
>>>
End Function
--
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/For...ccess/200705/1

May 22 '07 #4
biganthony via AccessMonster.com wrote:
Salad,

Thanks for replying.

First, I have full rights to the folder - it is a local folder.
Second, the error message is: "Path/File Access Error." and the error number
is 75.
Thirdly, I did this: msgbox Delete_Destination and the folder appears
correctly.

The strange thing is the code works on my desktop at home. That computer is
running Win XP x64 and Office 2003 Professional. When I run it on my laptop I
get the error. The laptop is running Win XP Pro and Office 2003 Professional.
Besides that, I cannot work out any other differences to help explain why it
won't work on my laptop.

Thanks again,
Anthony


salad wrote:
>>>Just realised that I highlighted the incorrect line. The line thar is failing
is:

[quoted text clipped - 3 lines]
>>>Is it failing because the folder to be deleted is still "locked" by the
browseforfolderbypath function?

Doubtful.

Do you have rights to delete the folder?

Prior to deleting, do something like
msgbox Delete_Destination
Does that look correct?

Do you get an error message? If so, what is the error number and error
message?

>>>>Hi,

[quoted text clipped - 123 lines]
>>>>End Function

This is what I have from A97 help on error 75. I doubt it's changed
much. Are you sure all subfolders and files have been removed first?
During a file-access or disk-access operation, for example, Open, MkDir,
ChDir, or RmDir, the operating system couldn't make a connection between
the path and the file name. This error has the following causes and
solutions:

· The file specification isn't correctly formatted.

A file name can contain a fully qualified (absolute) or relative path. A
fully qualified path starts with the drive name (if the path is on
another drive) and lists the explicit path from the root to the file.
Any path that isn't fully qualified is relative to the current drive and
directory.

· You attempted to save a file that would replace an existing read-only
file.

Change the read-only attribute of the target file or save the file with
a different file name.

· You attempted to open a read-only file in sequential Output or Append
mode.

Open the file in Input mode or change the read-only attribute of the file.

For additional information, select the item in question and press F1.
May 22 '07 #5
Help - Kill - See Also.

RmDir Statement

Syntax

RmDir path

The required path argument is a string expression that identifies the
directory or folder to be removed. The path may include the drive. If no
drive is specified, RmDir removes the directory or folder on the current
drive.

Remarks

An error occurs if you try to use RmDir on a directory or folder containing
files. Use the Kill statement to delete all files before attempting to
remove a directory or folder.

This example uses the RmDir statement to remove an existing directory or
folder.

' Assume that MYDIR is an empty directory or folder.
RmDir "MYDIR" ' Remove MYDIR.

Cheers,
Alan

"biganthony via AccessMonster.com" <u31673@uwewrote in
news:727d4bfe8f481@uwe:
Hi,

I have the following code to select a folder and then delete it. I
keep getting a Path/File error on the line that deletes the actual
folder. The line before that line deletes the files in the folder but
I get the error message when the procedure attempts to delete the
folder selected in the BrowseforFolderbyPath function.

How can I get it to delete the folder that the user has selected in
the Browse for Folder dialog?
Thanks,
Anthony
May 22 '07 #6
Alan,

All the files are deleted in the folder before attempting to delete the
folder.

The code I wrote above works on one computer but not the other. So there must
be something unique about the computer it does not work on. I'm at a loss to
determine why it doesn't work.

thanks
Anthony
Alan Carpenter wrote:
>Help - Kill - See Also.

RmDir Statement

Syntax

RmDir path

The required path argument is a string expression that identifies the
directory or folder to be removed. The path may include the drive. If no
drive is specified, RmDir removes the directory or folder on the current
drive.

Remarks

An error occurs if you try to use RmDir on a directory or folder containing
files. Use the Kill statement to delete all files before attempting to
remove a directory or folder.

This example uses the RmDir statement to remove an existing directory or
folder.

' Assume that MYDIR is an empty directory or folder.
RmDir "MYDIR" ' Remove MYDIR.

Cheers,
Alan
>Hi,
[quoted text clipped - 9 lines]
>Thanks,
Anthony
--
Message posted via http://www.accessmonster.com

May 22 '07 #7
On Mon, 21 May 2007 03:46:02 GMT, "biganthony via AccessMonster.com"
<u31673@uwewrote:

Can you delete the folder manually?
Can you programmatically delete another folder you just created (e.g.
c:\test1\)?
Right-click folder Properties. Anything unusual?

-Tom.

>Hi,

I have the following code to select a folder and then delete it. I keep
getting a Path/File error on the line that deletes the actual folder. The
line before that line deletes the files in the folder but I get the error
message when the procedure attempts to delete the folder selected in the
BrowseforFolderbyPath function.

How can I get it to delete the folder that the user has selected in the
Browse for Folder dialog?
Thanks,
Anthony
************************ BEGIN CODE SNIPPET ******************************

ArchiveFolder = BrowseForFolderByPath(ProgramPath)

'check if user has clicked the Cancel button.
If ArchiveFolder = vbNullString Then

Exit Sub

End If

'check if the selected folder is under the program folder.
If Left(ArchiveFolder, Len(ArchiveFolder) - 5) <ProgramPath Or
(Right(ArchiveFolder, 4)) Like "*[!0-9]*" Then

MsgBox "That is an invalid Archive folder." & Chr$(13) & Chr$(13)
& _
"Archives are located in the " & ProgramPath & " folder." & Chr$
(13) & Chr$(13) & _
"Please select an archive in the " & ProgramPath & " folder.",
vbOKOnly + vbInformation, "Invalid Archive Folder."

Exit Sub

End If

strDeleteQuestion = MsgBox("Do you really want to delete the " &
ArchiveFolder & " archive?", vbYesNo + vbQuestion, "Delete Archive.")

If strDeleteQuestion = vbYes Then

'delete all files in the selected archive folder.
Kill ArchiveFolder & "\*.*" <----------------
- this line works.

Delete_Destination = ArchiveFolder & "\" <------ this
line fails.

RmDir Delete_Destination

MsgBox "The Archive has been successfully deleted.", vbOKOnly
+ VbInformation, "Success!"

End If

**************************** END CODE SNIPPET
********************************************

This is the function I'm using for the BrowseforfolderbyPath:
Public Function BrowseForFolderByPath(sSelPath As String) As String

Dim BI As BROWSEINFO
Dim pidl As Long
Dim lpSelPath As Long
Dim spath As String * MAX_PATH

With BI
.hOwner = Me.hwnd
.pidlRoot = 0
If RestoreArchive = True Then
.lpszTitle = "Archives are located under the application's folder." &
Chr$(13) & "What Archive do you want to Restore?"
Else
.lpszTitle = "Archives are located under the application's folder." &
Chr$(13) & "What Archive do you want to Delete?"
End If

.lpfn = FARPROCl(AddressOf BrowseCallbackProcStr)

lpSelPath = LocalAlloc(LPTR, Len(sSelPath) + 1)
CopyMemory ByVal lpSelPath, ByVal sSelPath, Len(sSelPath) + 1
.lParam = lpSelPath

End With

pidl = SHBrowseForFolder(BI)

If pidl Then

If SHGetPathFromIDList(pidl, spath) Then
BrowseForFolderByPath = Left$(spath, InStr(spath, vbNullChar) - 1)
End If

Call CoTaskMemFree(pidl)

End If

Call LocalFree(lpSelPath)

End Function

Public Function IsWinNT() As Boolean

#If Win32 Then

Dim OSV As OSVERSIONINFO

OSV.OSVSize = Len(OSV)

'API returns 1 if a successful call
If GetVersionEx(OSV) = 1 Then

'PlatformId contains a value representing
'the OS, so if it's VER_PLATFORM_WIN32_NT,
'return true
IsWinNT = OSV.PlatformID = VER_PLATFORM_WIN32_NT
End If

#End If

End Function
May 22 '07 #8
Tom (and other respondents),

Thank you for taking time to read and help.

I can delete the folder manually through Windows Explorer.

After I receive the error message when attempting to delete the folder
through the above code, I click OK to clear the message. I look in Windows
Explorer and the folder is there but all files have been deleted (as expected)
So I tried something new: If I immediately click the delete archive button
again, the code above runs again. So I select the folder (which is now empty)
from the browseforfolderbypath function, it deletes the folder!

A check in Explorer reveals that the folder is now gone.

So in summary:

When I click the command button for the first time to select the folder for
deletion, the browse for folder dialog opens. I select the desired folder to
delete and click OK. The files are deleted but the folder remains. I receive
the error message as reported above.

I then click the command button to select the same folder for deletion, the
browse folder dialog opens. I select the same folder (which is now empty) and
click OK. The code above runs and the folder is deleted. The folder is
deleted success message appears on screen and a check in Explorer reveals the
folder is now gone.

I am confused - the above code works on one machine, but not the on I'm on
now.

Thanks to all for responding.

Anthony
Tom van Stiphout wrote:
>Can you delete the folder manually?
Can you programmatically delete another folder you just created (e.g.
c:\test1\)?
Right-click folder Properties. Anything unusual?

-Tom.
>>Hi,
[quoted text clipped - 123 lines]
>>
End Function
--
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/For...ccess/200705/1

May 22 '07 #9
Anthony,

Sorry about that. I read your message quickly, replied, read it again and
noticed my error and cancelled my original message. Too slow!

However, that stirred a memory. Could it be that one computer is much
faster than the other?
Perhaps DoEvents:

Kill ArchiveFolder & "\*.*"
Delete_Destination = ArchiveFolder & "\"
DoEvents <--- Added this.
RmDir Delete_Destination

Worth a try.

Cheers,
Alan
"biganthony via AccessMonster.com" <u31673@uwewrote in
news:728942a2e8bca@uwe:
Alan,

All the files are deleted in the folder before attempting to delete
the folder.

The code I wrote above works on one computer but not the other. So
there must be something unique about the computer it does not work on.
I'm at a loss to determine why it doesn't work.

thanks
Anthony
May 22 '07 #10
Alan,

The desktop computer is a Pentium IV 3.6 Ghz with 2 GB RAM and the code works.
The laptop is the slower computer and the code doesn't work. The laptop is 1.
73 Ghz Centrino with 1 GB RAM.

Nevertheless, I put the DoEvents line in as you suggested and it still cannot
delete the folder.

The folder is not Read-Only, I verified this in properties in Explorer.

Thanks for helping

Anthony

Alan Carpenter wrote:
>Anthony,

Sorry about that. I read your message quickly, replied, read it again and
noticed my error and cancelled my original message. Too slow!

However, that stirred a memory. Could it be that one computer is much
faster than the other?
Perhaps DoEvents:

Kill ArchiveFolder & "\*.*"
Delete_Destination = ArchiveFolder & "\"
DoEvents <--- Added this.
RmDir Delete_Destination

Worth a try.

Cheers,
Alan
>Alan,
[quoted text clipped - 7 lines]
>thanks
Anthony
--
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/For...ccess/200705/1

May 22 '07 #11
On Tue, 22 May 2007 04:54:37 GMT, "biganthony via AccessMonster.com"
<u31673@uwewrote:

It seems to be a timing issue. I might write a loop:

Public Declare Function GetTickCount Lib "kernel32" Alias
"GetTickCount" () As Long

Sub SleepMsec(msec as Long)
dim dwTickCount as long
dwTickCount=GetTickCount()
do
DoEvents
loop until GetTickCount() dwTickCount + msec
End sub

Then I might call this repeatedly until I give up or the file is
removed:
dim intLoopCount as integer
intLoopCount = 0
On Error Resume Next
Do
RmDir ...
If Err.Number = 0 then
Exit Do 'folder was removed
Else
SleepMsec(100)
End If
intLoopCount = intLoopCount + 1
Loop until intLoopCount 10
On Error Goto ErrorLabel

-Tom.

>Tom (and other respondents),

Thank you for taking time to read and help.

I can delete the folder manually through Windows Explorer.

After I receive the error message when attempting to delete the folder
through the above code, I click OK to clear the message. I look in Windows
Explorer and the folder is there but all files have been deleted (as expected)
So I tried something new: If I immediately click the delete archive button
again, the code above runs again. So I select the folder (which is now empty)
from the browseforfolderbypath function, it deletes the folder!

A check in Explorer reveals that the folder is now gone.

So in summary:

When I click the command button for the first time to select the folder for
deletion, the browse for folder dialog opens. I select the desired folder to
delete and click OK. The files are deleted but the folder remains. I receive
the error message as reported above.

I then click the command button to select the same folder for deletion, the
browse folder dialog opens. I select the same folder (which is now empty) and
click OK. The code above runs and the folder is deleted. The folder is
deleted success message appears on screen and a check in Explorer reveals the
folder is now gone.

I am confused - the above code works on one machine, but not the on I'm on
now.

Thanks to all for responding.

Anthony
Tom van Stiphout wrote:
>>Can you delete the folder manually?
Can you programmatically delete another folder you just created (e.g.
c:\test1\)?
Right-click folder Properties. Anything unusual?

-Tom.
>>>Hi,
[quoted text clipped - 123 lines]
>>>
End Function
May 22 '07 #12
Anthony

I wonder if the slower computer has an slower Hard Drive and needs just a
little more time to empty the Folder.

Meanwhile, here's another unlikely case I didn't consider, but is probably
worth adding to the code (Properly, of course!)

If CurDir = Delete_Destination Then ... Drink heavily. :-)

Here's another straw to clutch.

while Len(Dir(ArchiveFolder & "\*.*"))
Kill ArchiveFolder & "\*.*"
DoEvents
Wend
... and some more DoEvents for luck.

It'll still knock them all out at once, but maybe the problem is trying to
convince the Drive that Yes, the folder really, truely IS empty.

Cheers,
Alan

"biganthony via AccessMonster.com" <u31673@uwewrote in
news:728bdb55f125a@uwe:
Alan,

The desktop computer is a Pentium IV 3.6 Ghz with 2 GB RAM and the
code works. The laptop is the slower computer and the code doesn't
work. The laptop is 1. 73 Ghz Centrino with 1 GB RAM.

Nevertheless, I put the DoEvents line in as you suggested and it still
cannot delete the folder.

The folder is not Read-Only, I verified this in properties in
Explorer.

Thanks for helping

Anthony
May 22 '07 #13
Alan,

Thanks for the suggestion. I will try when I get home from work tonight. May
even drink heavily!

Anthony
Alan Carpenter wrote:
>Anthony

I wonder if the slower computer has an slower Hard Drive and needs just a
little more time to empty the Folder.

Meanwhile, here's another unlikely case I didn't consider, but is probably
worth adding to the code (Properly, of course!)

If CurDir = Delete_Destination Then ... Drink heavily. :-)

Here's another straw to clutch.

while Len(Dir(ArchiveFolder & "\*.*"))
Kill ArchiveFolder & "\*.*"
DoEvents
Wend
.. and some more DoEvents for luck.

It'll still knock them all out at once, but maybe the problem is trying to
convince the Drive that Yes, the folder really, truely IS empty.

Cheers,
Alan
>Alan,
[quoted text clipped - 11 lines]
>>
Anthony
--
Message posted via http://www.accessmonster.com

May 22 '07 #14
Tom,

Thanks for your help. I will try your idea along with Alan's when I get home
from work tonight.

Anthony
Tom van Stiphout wrote:
>It seems to be a timing issue. I might write a loop:

Public Declare Function GetTickCount Lib "kernel32" Alias
"GetTickCount" () As Long

Sub SleepMsec(msec as Long)
dim dwTickCount as long
dwTickCount=GetTickCount()
do
DoEvents
loop until GetTickCount() dwTickCount + msec
End sub

Then I might call this repeatedly until I give up or the file is
removed:
dim intLoopCount as integer
intLoopCount = 0
On Error Resume Next
Do
RmDir ...
If Err.Number = 0 then
Exit Do 'folder was removed
Else
SleepMsec(100)
End If
intLoopCount = intLoopCount + 1
Loop until intLoopCount 10
On Error Goto ErrorLabel

-Tom.
>>Tom (and other respondents),
[quoted text clipped - 44 lines]
>>>>
End Function
--
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/For...ccess/200705/1

May 22 '07 #15
Hi Tom,

Found some time here at work to try your idea. When I select the folder in
the browseforfolder box, and click OK, I get the "Archive deleted" success
message, but the folder still remains. The contents are deleted.
This is the code as it stands now:

************************************************** ***

ArchiveFolder = BrowseForFolderByPath(ProgramPath)

strQuestion1 = MsgBox("Do you really want to delete the " &
ArchiveFolder & " archive?", vbYesNo + vbQuestion, "Delete Archive.")

If strQuestion1 = vbYes Then

strResponse = InputBox("Enter DELETE to continue." & vbCrLf &
vbLf & _
"Click Cancel to exit.", "Delete Archive.")

If strResponse = "DELETE" Or Delete_Response = "delete" Or
Delete_Response = "Delete" Then

'delete all files in the selected archive folder.
Kill ArchiveFolder & "\*.*"
Delete_Destination = ArchiveFolder & "\"

Dim intLoopCount As Integer
intLoopCount = 0
On Error Resume Next
Do
RmDir Delete_Destination
If Err.Number = 0 Then
Exit Do 'folder was removed
Else
SleepMsec (100)
End If
intLoopCount = intLoopCount + 1
Loop Until intLoopCount 10
On Error GoTo ErrHandler:
MsgBox "The Archive has been successfully deleted.", vbOKOnly
+ vbInformation, "Success!"
End If

************************************************** ***

Regards
Anthony

Tom van Stiphout wrote:
>It seems to be a timing issue. I might write a loop:

Public Declare Function GetTickCount Lib "kernel32" Alias
"GetTickCount" () As Long

Sub SleepMsec(msec as Long)
dim dwTickCount as long
dwTickCount=GetTickCount()
do
DoEvents
loop until GetTickCount() dwTickCount + msec
End sub

Then I might call this repeatedly until I give up or the file is
removed:
dim intLoopCount as integer
intLoopCount = 0
On Error Resume Next
Do
RmDir ...
If Err.Number = 0 then
Exit Do 'folder was removed
Else
SleepMsec(100)
End If
intLoopCount = intLoopCount + 1
Loop until intLoopCount 10
On Error Goto ErrorLabel

-Tom.
>>Tom (and other respondents),
[quoted text clipped - 44 lines]
>>>>
End Function
--
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/For...ccess/200705/1

May 23 '07 #16
Since I'm already butting in ...

Anthony, I should have been more specific earlier.

Tom. I've inserted a few lines into the quoted code below.

Cheers,
Alan

"biganthony via AccessMonster.com" <u31673@uwewrote in
news:72949699a0f24@uwe:
Hi Tom,

Found some time here at work to try your idea. When I select the
folder in the browseforfolder box, and click OK, I get the "Archive
deleted" success message, but the folder still remains. The contents
are deleted.
This is the code as it stands now:

************************************************** ***

ArchiveFolder = BrowseForFolderByPath(ProgramPath)

strQuestion1 = MsgBox("Do you really want to delete the " &
ArchiveFolder & " archive?", vbYesNo + vbQuestion, "Delete Archive.")

If strQuestion1 = vbYes Then

strResponse = InputBox("Enter DELETE to continue." &
vbCrLf &
vbLf & _
"Click Cancel to exit.", "Delete Archive.")

If strResponse = "DELETE" Or Delete_Response = "delete" Or
Delete_Response = "Delete" Then
'You may prefer:
If UCase(strResponse) = "DELETE" Then

Debug.Print CurDir
If CurDir = ArchiveFolder Then
ChDir ArchiveFolder & "\.."
End If

'delete all files in the selected archive folder.
Kill ArchiveFolder & "\*.*"
Delete_Destination = ArchiveFolder & "\"

Dim intLoopCount As Integer
intLoopCount = 0
On Error Resume Next
Do
RmDir Delete_Destination
If Err.Number = 0 Then
Exit Do 'folder was removed
Else
SleepMsec (100)
End If
intLoopCount = intLoopCount + 1
Loop Until intLoopCount 10
On Error GoTo ErrHandler:
MsgBox "The Archive has been successfully deleted.",
vbOKOnly
+ vbInformation, "Success!"
End If

************************************************** ***

Regards
Anthony
<Tom's code ... not snipped>

Tom van Stiphout wrote:
>>It seems to be a timing issue. I might write a loop:

Public Declare Function GetTickCount Lib "kernel32" Alias
"GetTickCount" () As Long

Sub SleepMsec(msec as Long)
dim dwTickCount as long
dwTickCount=GetTickCount()
do
DoEvents
loop until GetTickCount() dwTickCount + msec
End sub

Then I might call this repeatedly until I give up or the file is
removed:
dim intLoopCount as integer
intLoopCount = 0
On Error Resume Next
Do
RmDir ...
If Err.Number = 0 then
Exit Do 'folder was removed
Else
SleepMsec(100)
End If
intLoopCount = intLoopCount + 1
Loop until intLoopCount 10
On Error Goto ErrorLabel

-Tom.
>>>Tom (and other respondents),
[quoted text clipped - 44 lines]
>>>>>
>End Function
May 23 '07 #17
Hi Alan,

Tried your suggestion, I am still getting the error 75 File / Path Access
Error Message.
I am thinking of ditching the delete routine altogether and tell the user in
my office to delete the folder manually in explorer!

The annoying thing is, the folder gets deleted the second time round. The
first time I click the delete button, it deletes all files and then reports
the File/Path Access error message. Then when I click the delete buttton a
second time, select the same folder in browseforfolder box, the folder gets
deleted and the success message is displayed.

Regards
Anthony

Alan Carpenter wrote:
>Since I'm already butting in ...

Anthony, I should have been more specific earlier.

Tom. I've inserted a few lines into the quoted code below.

Cheers,
Alan
>Hi Tom,
[quoted text clipped - 21 lines]
> If strResponse = "DELETE" Or Delete_Response = "delete" Or
Delete_Response = "Delete" Then
'You may prefer:
If UCase(strResponse) = "DELETE" Then

Debug.Print CurDir
If CurDir = ArchiveFolder Then
ChDir ArchiveFolder & "\.."
End If

> 'delete all files in the selected archive folder.
Kill ArchiveFolder & "\*.*"
[quoted text clipped - 60 lines]
>>>>>>
>>End Function
--
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/For...ccess/200705/1

May 23 '07 #18
On Wed, 23 May 2007 22:06:12 GMT, "biganthony via AccessMonster.com"
<u31673@uwewrote:

No, don't give up yet. We want to see you succeed.
What's your best code at this time?

-Tom.

>Hi Alan,

Tried your suggestion, I am still getting the error 75 File / Path Access
Error Message.
I am thinking of ditching the delete routine altogether and tell the user in
my office to delete the folder manually in explorer!
<clip>
May 24 '07 #19
Hi Anthony.

I've managed to reproduce the error, I think, but it was still random.

I ran the following code in the VBE, with the Immediate window open.
Twice the system showed me the Folder was there after it had been deleted.

The setup at the start is just because I'm too lazy to recreate the start
situation, and it lets me lean on F5 for a high speed run. :-)

You could use your FolderBrowse... in place of QuickChoose, or just replace
the Const with a test Drive/Path on the laptop.
ArchiveFolder = QuickChoose

As it stands, I can lean on F5 and go through the code a couple of hundred
times without error. Twice I say a Dir value for the folder after it had
been deleted.
There are no Permissions issues on my computer, so that's another point
towards a Timing issue rather than a Rights issue (which is unlikely if you
can manually delete the folder.)

If you run the code and get an error, then you have something to work on.
Maybe delete the Folder, wait 1 second and delete again with the checks as
below.

Failing that, perhaps percussive maintenance followed by a new laptop?

Cheers,
Alan

'######## Careful. I Delete things. ########
Option Compare Database
Option Explicit
Private Const QuickChoose As String = "O:\Temp2\Temp3"
Sub Test()
'---- Prepare for test - Hold down F5
Dim ArchiveFolder$, AF$
Dim iNum%
Static iCount
iCount = iCount + 1
ArchiveFolder = QuickChoose
AF = ArchiveFolder
ChDrive AF
If Len(Dir(AF, vbDirectory)) = 0 Then
MkDir (AF)
End If
ChDir AF
iNum = FreeFile
Open "Empty.txt" For Output As iNum
Close iNum
'MsgBox CurDir & vbCrLf & Dir(AF & "\")
'---- Ready for test......

'RmDir AF & "\NoNameLikeThis" 'Error 75
'Err.Raise 75 'Lazy way to Help.

While Len(Dir(AF & "\*.*")) 'Avoid "Not Found.. Error if empty
Kill AF & "\*.*"
Debug.Print "Found some and killed them."
DoEvents
Wend

If CurDir = AF Then
ChDir AF & "\.."
Debug.Print "Don't sit on branch while sawing..."
End If

Debug.Print Dir(AF, vbDirectory) 'Who am I?
Debug.Print GetAttr(AF) ' 16 means plain Folder
RmDir AF
Debug.Print Dir(AF, vbDirectory) & "<--" 'It was there Twice in my tests.
On Error Resume Next
Debug.Print GetAttr(AF) & "<--Attribute" '..but OS can't find it.
If Err.Number <53 Then Stop 'Rem out.
Debug.Print Err.Description; " "; Err.Number
On Error GoTo 0
Debug.Print Dir(AF, vbDirectory) & "<--" 'It was never here
Debug.Print iCount
End Sub

################

"biganthony via AccessMonster.com" <u31673@uwewrote in
news:72a00c512485c@uwe:
Hi Alan,

Tried your suggestion, I am still getting the error 75 File / Path
Access Error Message.
I am thinking of ditching the delete routine altogether and tell the
user in my office to delete the folder manually in explorer!

The annoying thing is, the folder gets deleted the second time round.
The first time I click the delete button, it deletes all files and
then reports the File/Path Access error message. Then when I click the
delete buttton a second time, select the same folder in
browseforfolder box, the folder gets deleted and the success message
is displayed.

Regards
Anthony
<snip>
May 24 '07 #20
On Wed, 23 May 2007 22:06:12 GMT, "biganthony via AccessMonster.com"
<u31673@uwewrote:

Any way to use a deltree command?
>Hi Alan,

Tried your suggestion, I am still getting the error 75 File / Path Access
Error Message.
I am thinking of ditching the delete routine altogether and tell the user in
my office to delete the folder manually in explorer!

The annoying thing is, the folder gets deleted the second time round. The
first time I click the delete button, it deletes all files and then reports
the File/Path Access error message. Then when I click the delete buttton a
second time, select the same folder in browseforfolder box, the folder gets
deleted and the success message is displayed.

Regards
Anthony

Alan Carpenter wrote:
>>Since I'm already butting in ...

Anthony, I should have been more specific earlier.

Tom. I've inserted a few lines into the quoted code below.

Cheers,
Alan
>>Hi Tom,
[quoted text clipped - 21 lines]
>> If strResponse = "DELETE" Or Delete_Response = "delete" Or
Delete_Response = "Delete" Then
'You may prefer:
If UCase(strResponse) = "DELETE" Then

Debug.Print CurDir
If CurDir = ArchiveFolder Then
ChDir ArchiveFolder & "\.."
End If

>> 'delete all files in the selected archive folder.
Kill ArchiveFolder & "\*.*"
[quoted text clipped - 60 lines]
>>>>>>>
>>>End Function
May 24 '07 #21
Hi Alan,

I will try this code this weekend and report back.

Reagrds
Anthony
Alan Carpenter wrote:
>Hi Anthony.

I've managed to reproduce the error, I think, but it was still random.

I ran the following code in the VBE, with the Immediate window open.
Twice the system showed me the Folder was there after it had been deleted.

The setup at the start is just because I'm too lazy to recreate the start
situation, and it lets me lean on F5 for a high speed run. :-)

You could use your FolderBrowse... in place of QuickChoose, or just replace
the Const with a test Drive/Path on the laptop.
ArchiveFolder = QuickChoose

As it stands, I can lean on F5 and go through the code a couple of hundred
times without error. Twice I say a Dir value for the folder after it had
been deleted.
There are no Permissions issues on my computer, so that's another point
towards a Timing issue rather than a Rights issue (which is unlikely if you
can manually delete the folder.)

If you run the code and get an error, then you have something to work on.
Maybe delete the Folder, wait 1 second and delete again with the checks as
below.

Failing that, perhaps percussive maintenance followed by a new laptop?

Cheers,
Alan

'######## Careful. I Delete things. ########
Option Compare Database
Option Explicit
Private Const QuickChoose As String = "O:\Temp2\Temp3"
Sub Test()
'---- Prepare for test - Hold down F5
Dim ArchiveFolder$, AF$
Dim iNum%
Static iCount
iCount = iCount + 1
ArchiveFolder = QuickChoose
AF = ArchiveFolder
ChDrive AF
If Len(Dir(AF, vbDirectory)) = 0 Then
MkDir (AF)
End If
ChDir AF
iNum = FreeFile
Open "Empty.txt" For Output As iNum
Close iNum
'MsgBox CurDir & vbCrLf & Dir(AF & "\")
'---- Ready for test......

'RmDir AF & "\NoNameLikeThis" 'Error 75
'Err.Raise 75 'Lazy way to Help.

While Len(Dir(AF & "\*.*")) 'Avoid "Not Found.. Error if empty
Kill AF & "\*.*"
Debug.Print "Found some and killed them."
DoEvents
Wend

If CurDir = AF Then
ChDir AF & "\.."
Debug.Print "Don't sit on branch while sawing..."
End If

Debug.Print Dir(AF, vbDirectory) 'Who am I?
Debug.Print GetAttr(AF) ' 16 means plain Folder
RmDir AF
Debug.Print Dir(AF, vbDirectory) & "<--" 'It was there Twice in my tests.
On Error Resume Next
Debug.Print GetAttr(AF) & "<--Attribute" '..but OS can't find it.
If Err.Number <53 Then Stop 'Rem out.
Debug.Print Err.Description; " "; Err.Number
On Error GoTo 0
Debug.Print Dir(AF, vbDirectory) & "<--" 'It was never here
Debug.Print iCount
End Sub

################
>Hi Alan,
[quoted text clipped - 12 lines]
>Regards
Anthony

<snip>
--
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/For...ccess/200705/1

May 24 '07 #22
Chuck wrote:
On Wed, 23 May 2007 22:06:12 GMT, "biganthony via AccessMonster.com"
<u31673@uwewrote:

Any way to use a deltree command?

Or a batch file where one can pass a parameter to the batch?
>>Hi Alan,

Tried your suggestion, I am still getting the error 75 File / Path Access
Error Message.
I am thinking of ditching the delete routine altogether and tell the user in
my office to delete the folder manually in explorer!

The annoying thing is, the folder gets deleted the second time round. The
first time I click the delete button, it deletes all files and then reports
the File/Path Access error message. Then when I click the delete buttton a
second time, select the same folder in browseforfolder box, the folder gets
deleted and the success message is displayed.

Regards
Anthony

Alan Carpenter wrote:
>>>Since I'm already butting in ...

Anthony, I should have been more specific earlier.

Tom. I've inserted a few lines into the quoted code below.

Cheers,
Alan
Hi Tom,
[quoted text clipped - 21 lines]

If strResponse = "DELETE" Or Delete_Response = "delete" Or
Delete_Response = "Delete" Then

'You may prefer:
If UCase(strResponse) = "DELETE" Then

Debug.Print CurDir
If CurDir = ArchiveFolder Then
ChDir ArchiveFolder & "\.."
End If

'delete all files in the selected archive folder.
Kill ArchiveFolder & "\*.*"

[quoted text clipped - 60 lines]

>>>>End Function

May 24 '07 #23
Hi Alan,

Good news! I used your code and it deleted the folder. This is what I have:

************************************************** ***************************************
ProgramPath = [Application].[CurrentProject].[Path]
ArchiveFolder = BrowseForFolderByPath(ProgramPath)

strResponse = InputBox("Enter DELETE to continue." & vbCrLf & vbLf &
_
"Click Cancel to exit.", "Delete Archive.")

If UCase(strResponse) = "DELETE" Then

AF = ArchiveFolder
ChDrive AF
ChDir AF
While Len(Dir(AF & "\*.*"))
Kill AF & "\*.*"
DoEvents
Wend

If CurDir = AF Then
ChDir AF & "\.."
End If

RmDir AF

MsgBox "The Archive has been successfully deleted.", vbOKOnly
+ vbInformation, "Success!"

endif

************************************************** *******

This works and the folder is completely deleted - verified by checking with
Windows Explorer. This also works on the desktop computer.

So thank you very much!

Regards
Anthony



Alan Carpenter wrote:
>Hi Anthony.

I've managed to reproduce the error, I think, but it was still random.

I ran the following code in the VBE, with the Immediate window open.
Twice the system showed me the Folder was there after it had been deleted.

The setup at the start is just because I'm too lazy to recreate the start
situation, and it lets me lean on F5 for a high speed run. :-)

You could use your FolderBrowse... in place of QuickChoose, or just replace
the Const with a test Drive/Path on the laptop.
ArchiveFolder = QuickChoose

As it stands, I can lean on F5 and go through the code a couple of hundred
times without error. Twice I say a Dir value for the folder after it had
been deleted.
There are no Permissions issues on my computer, so that's another point
towards a Timing issue rather than a Rights issue (which is unlikely if you
can manually delete the folder.)

If you run the code and get an error, then you have something to work on.
Maybe delete the Folder, wait 1 second and delete again with the checks as
below.

Failing that, perhaps percussive maintenance followed by a new laptop?

Cheers,
Alan

'######## Careful. I Delete things. ########
Option Compare Database
Option Explicit
Private Const QuickChoose As String = "O:\Temp2\Temp3"
Sub Test()
'---- Prepare for test - Hold down F5
Dim ArchiveFolder$, AF$
Dim iNum%
Static iCount
iCount = iCount + 1
ArchiveFolder = QuickChoose
AF = ArchiveFolder
ChDrive AF
If Len(Dir(AF, vbDirectory)) = 0 Then
MkDir (AF)
End If
ChDir AF
iNum = FreeFile
Open "Empty.txt" For Output As iNum
Close iNum
'MsgBox CurDir & vbCrLf & Dir(AF & "\")
'---- Ready for test......

'RmDir AF & "\NoNameLikeThis" 'Error 75
'Err.Raise 75 'Lazy way to Help.

While Len(Dir(AF & "\*.*")) 'Avoid "Not Found.. Error if empty
Kill AF & "\*.*"
Debug.Print "Found some and killed them."
DoEvents
Wend

If CurDir = AF Then
ChDir AF & "\.."
Debug.Print "Don't sit on branch while sawing..."
End If

Debug.Print Dir(AF, vbDirectory) 'Who am I?
Debug.Print GetAttr(AF) ' 16 means plain Folder
RmDir AF
Debug.Print Dir(AF, vbDirectory) & "<--" 'It was there Twice in my tests.
On Error Resume Next
Debug.Print GetAttr(AF) & "<--Attribute" '..but OS can't find it.
If Err.Number <53 Then Stop 'Rem out.
Debug.Print Err.Description; " "; Err.Number
On Error GoTo 0
Debug.Print Dir(AF, vbDirectory) & "<--" 'It was never here
Debug.Print iCount
End Sub

################
>Hi Alan,
[quoted text clipped - 12 lines]
>Regards
Anthony

<snip>
--
Message posted via http://www.accessmonster.com

May 27 '07 #24
Hi Anthony.

I'm pleased you got a good result. My guess is that RmDir failed because
ArchiveFolder was the Active Directory at the time.

These two lines ...

ChDrive AF
ChDir AF

.... were there only to force the error while testing, and just in theory
should be removed.

Cheers,
Alan

"biganthony via AccessMonster.com" <u31673@uwewrote in
news:72cc46159501b@uwe:
Hi Alan,

Good news! I used your code and it deleted the folder. This is what I
have:

************************************************** *********************
******************
ProgramPath = [Application].[CurrentProject].[Path]
ArchiveFolder = BrowseForFolderByPath(ProgramPath)

strResponse = InputBox("Enter DELETE to continue." & vbCrLf &
vbLf &
_
"Click Cancel to exit.", "Delete Archive.")

If UCase(strResponse) = "DELETE" Then

AF = ArchiveFolder
ChDrive AF
ChDir AF
While Len(Dir(AF & "\*.*"))
Kill AF & "\*.*"
DoEvents
Wend

If CurDir = AF Then
ChDir AF & "\.."
End If

RmDir AF

MsgBox "The Archive has been successfully deleted.",
vbOKOnly
+ vbInformation, "Success!"

endif

************************************************** *******

This works and the folder is completely deleted - verified by checking
with Windows Explorer. This also works on the desktop computer.

So thank you very much!

Regards
Anthony
May 27 '07 #25

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
12117
by: Charts | last post by:
I login as administrator of the machine. However running the following code get access denied exception for file inside the directory. The source code: DirectoryInfo target = new...
2
2384
by: Cesar Ronchese | last post by:
Hello, I'm experiencing a very weird problem. I have a ASP.Net 2005 application (VB.Net) that creates some folders to store temporary files. example: Session_Start(...)...
6
24606
by: lumpybanana247 | last post by:
anybody know how i could delete a FOLDER in c++? i know to delete a file is #include <iostream> #include <fstream> using namespace std; /* remove example: remove myfile.txt */
5
33119
by: fniles | last post by:
I am using VB.NET 2005. When I try to delete a folder that has files underneath it, it gave me "the directory is not empty" error. f = New IO.DirectoryInfo("C:\myfolder") If f.Exists Then...
1
1285
by: =?Utf-8?B?QlQ=?= | last post by:
I am having problems with deleting some of my e-mail that has been put in the delete folder. It started with a few e-mails and has expanded to over 100 now. I get a Message that says ,Message...
4
1634
by: sunilkds | last post by:
I want code for how to copy folder,delete folder from one location to another. Plz give example I tried in this code but i couldnt move folder but i moved files(coy), code, path =...
9
2548
by: kashif73 | last post by:
Hi Everyone, How can I share a folder in ASP? I know how to create / delete folder using File System Object but can't figure out how to share a folder / files. Thanks.
4
2003
anfetienne
by: anfetienne | last post by:
hi ive got a folder on my server which is created by apache and the only way to delete it is with server coding. can someone tell me a way to delete that folder including all files and folders...
2
4915
Airslash
by: Airslash | last post by:
Hi, I'm currently working on a function to delete a folder and its files + subfolders. The function currently works for the target folder, but refuses to delete the subfolders and files in the...
0
7131
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7007
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7174
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7220
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
6894
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
1
4919
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
3099
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
1427
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
665
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.