473,387 Members | 1,549 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

deleting a directory

9
Hi

I am moving list of files from one directory to another directory.i am doing it by first moving all the files from the source directory to destination directory using filecopy command.then using rmdir command to remove the source directory..
the problem which i am facing is..
For example, i have two files in the directory named A and the size of the total dir is some 6.00kb. after deleting the files in the directory A i thought the directory size also becomes empty.but its showing 6.00kb eventhough no files are there in the deirectory.so i am getting an error
"file/path access error " while removing the directory using rmdir.

Anyone plz tell me how can i resolve this problem
Thanks in advance
Kalai
Dec 11 '06 #1
4 1631
Killer42
8,435 Expert 8TB
Any chance you could post the existing code here, so we can see exactly what you've done so far? (Just the parts relevant to moving the files, that is).

(Also, I wonder whether Windows Indexing Service might be trying to update things and getting in the way.)
Dec 11 '06 #2
RKalai
9
the necessary code is below...plz help me to delete the files and directory permanently.

Private Sub cmdDVD_Click()

dname = Dir1.Path
chcount = InStrRev(dname, "\")
dirname = Mid(dname, chcount + 1, Len(dname))
dpath = "c:\dvd\" & dirname
If Dir(dpath, vbDirectory) = vbNullString Then
MkDir dpath
End If

For fcount = 0 To File1.ListCount - 1
DirPath = Dir1.Path & "\" & File1.List(fcount)
dest = dpath & "\" & File1.List(fcount)
FileCopy DirPath, dest
'Kill DirPath
delete DirPath
Next fcount

RmDir Dir1.Path
MsgBox "archived in " & dpath


End Sub
thanks
Kalai
Dec 12 '06 #3
Killer42
8,435 Expert 8TB
Is it possible that there are hidden files in the directory?

Another thing which comes to mind is that Windows XP often refuses to let you delete a directory because some program has it open. In this case, it might be your own program. Try changing the current directory, or the Path of your dir/file listboxes before doing the RmDir, so that nothing is referencing that directory.

As an example of what I mean, I've had cases where I opened a DOS window to go and delete some files (or view then, or whatever). Then in Explorer, I deleted everything in the folder, and tried to delete it. Windows wouldn't let me, because it was in use. I had to close the DOS window, or change its current directory, before I could do it.

P.S. Where are you seeing the 6 KB size after deleting the files? Maybe you just need to refresh something.
Dec 12 '06 #4
RKalai
9
what u hve mentioned is correct.i changed the path of the dirlist before deleting.it works fine.
thank you very much.
Kalai

Is it possible that there are hidden files in the directory?

Another thing which comes to mind is that Windows XP often refuses to let you delete a directory because some program has it open. In this case, it might be your own program. Try changing the current directory, or the Path of your dir/file listboxes before doing the RmDir, so that nothing is referencing that directory.

As an example of what I mean, I've had cases where I opened a DOS window to go and delete some files (or view then, or whatever). Then in Explorer, I deleted everything in the folder, and tried to delete it. Windows wouldn't let me, because it was in use. I had to close the DOS window, or change its current directory, before I could do it.

P.S. Where are you seeing the 6 KB size after deleting the files? Maybe you just need to refresh something.
Dec 14 '06 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: Guinness Mann | last post by:
Greetings, I can't figure out what to search on to find the documentation on how to completely delete a "solution" from VS.NET 2003. I have no problem at all deleting projects, but even if I...
5
by: Rosa | last post by:
Hi, I'm trying to clear the TIF on Windows XP programmatically with the below code. This code works fine on any folder but the TIF. For some reason the atEnd() statements always defaults to true...
6
by: Martin Bischoff | last post by:
Hi, I'm creating temporary directories in my web app (e.g. ~/data/temp/temp123) to allow users to upload files. When I later delete these directories (from the code behind), the application...
4
by: osh.sean | last post by:
I'm having a problem and I can't find anything about this anywhere else out there. I'm working on a solution that allows the end user to create folders / upload files to the web server. Some...
1
by: Lee | last post by:
Hi, when deleting a directory using;- string dir = "whatever"; Directory.Delete(dir); it fails if files/directories exist within the directory being deleted. is there an easy way of...
5
by: Sandeep Singh Sekhon | last post by:
I am Developing a Web Application with ASP.NET 1.1 I have one project Folder which is virtual directory of IIS. In this directory, I have one Folder named Photos in which I used to Store Photos....
2
by: vikram.lakhotia | last post by:
Hi Have you tried deleting a directory in Asp.Net. Here is an article discussing the problem deleting a Directory in Asp.Net http://www.vikramlakhotia.com/Deleting_Directory_in_ASPnet_20.aspx...
3
by: Kimera.Kimera | last post by:
I'm trying to write a program in VB.net 2003 that basically deletes all files, folders, sub-folders and sub-sub folders (etc). The program is simply for deleting the Windows/Temp folder contents,...
12
Nepomuk
by: Nepomuk | last post by:
Hi! I want to have my program delete some folders including all contents. For that, I wrote this method: private static void delete(String source) { File tmp = new File(source);...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
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
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
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
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...

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.