[2008] Delete Files In Use?
Jan 21, 2009How can you delete files in use? I am trying to clear the history and delete temporary internet files in my program. However, I get this error when trying to delete the history:
[Code]....
How can you delete files in use? I am trying to clear the history and delete temporary internet files in my program. However, I get this error when trying to delete the history:
[Code]....
What I basicly want is, a program with-Check boxs, user can check what they want to delete.The check box has to "tell" the button what to delete
Checkbox1= Temp
Checkbox2=Firefox History
Checkbox3=Firefox Cookies
[code].....
I am trying to delete multiple files (.reg files) by using following code.
Quote:
My.Computer.FileSystem.DeleteFile(Environ("%systemdrive%") & "*.reg")ut its is generating an exception: Argument Exception was Unhandled.Illegal Characters in path.
I can't figure out how to do this...I'm trying to search a directory for files,I have files that are like this:
File.doc
File 1.doc
File 2.doc
[code].....
For some reason I have ended up having filename without extension from my vb.net application but it has period in it.
example "filename." (just a DOT but no extension)
Now the problem is I cannot delete these files and it says could not find file.
I have a Visual Basic project in Visual Studio 2008. Do I need to keep the .RESX file that seem to be associated with each of my forms?
View 2 RepliesI'm using this code to delete all the downloads from the download folder.
Dim strUserDir As String = Environ("USERPROFILE")
For Each foundFile As String In My.Computer.FileSystem.GetFiles(strUserDir & "\Downloads", FileIO.SearchOption.SearchAllSubDirectories, "*.*")
My.computer.filesystem.deletefile(foundfile)
This app is just for me to use.The reason why i'm making this app is because i downlaod a lot a files and i want an easier way to delete them.
I was wondering how i would go about make my program loop threw files in a folder and if that file is .jpg it will delete I use this to see if the file exists and delete it
If System.IO.File.Exists("file.jpg") = True Then
System.IO.File.Delete("file.jpg.jpg")
End If
but how would i do a loop and grab every .jpb file so they can be deleted
I would like to know how to delete all files and folders under a certain directory. For example if I wanted to delete all files and folders in C:est how would I do that?
View 6 RepliesI Know how to delete files permanently like this
[Code]...
here is the code i use for adding folders to the treenode. it works great but i want a delete button for deleting both files and folders... and how can i make the treenode auto refreshing. or refreshing when exiting another form...
Private Sub PopulateTreeView(ByVal dir As String, ByVal parentNode As TreeNode)
Dim folder As String = String.Empty
Try
[Code]....
I've set up a basic loop to delete all the files in a particular folder. I've set the loop in a Try block so it doesn't crash the application when it gets to a file it can't delete. I'd like for the app to just pass over these type of files. At the moment, my loop stops completely when it gets to that exception.
View 1 Repliesi need to access to a special folder and operate there, but i don't have permission to do this, how i can set permission to access to special folder and delete/create files?
View 18 RepliesCan someone point me in the direction for displaying the contents of a folder on the form with a check box, then if someone wants to delete a file then check the box and hit delete. How can I do that?
View 5 Repliesi wanna be able to check if the file "thisfile.exe" exists, and if it does then delete all the other *.exe files it finds but not deleteing the "thisfile.exe", how would i be able to do that?
edit - im using vb 2008 express?
I have an external hard disk drive for data backup purpose. Now I want to delete all mp3 files in that drive. How do I do it?NOTE: The mp3 files are contained within many nested folders. For example, K:(artist name)(album name)mp3 filesUpdate: I tried using system.io.directory.getallfiles(), but my mp3 files are contained in many many folders. My current approach is not working
View 4 RepliesThe MSDN Express Library 2008 suggests the following example to delete all of the files in a folderFor Each foundFile As String In My.Computer.FileSystem.GetFiles( My.Computer.FileSystem.SpecialDirectories.MyDocuments, FileIO.SearchOption.SearchAllSubDirectories, "*.*")
My.Computer.FileSystem.DeleteFile(foundFile, FileIO.UIOption.AllDialogs,FileIO.RecycleOption.DeletePermanently)NextI would like to adapt this code to delete all the files in a folder of my choosing; for example, all the files in c:msdnimages. But I'm not getting anywhere.Would someone be kind enough to explain how to substitute c:msdnimages for SpecialDirectories.
I am trying to build a program to delete temporary files from my c drive.
View 3 RepliesI'm writing a little app that I can tell to delete files older than x amount of days.
You select a folder and click go and it does the job but it only does the files within that folder. What I want to do is also delete all the files in all the sub folders. [code]....
I was trying to do something like this (that worked with the Kill method of VB6) System.IO.File.Delete(OrderInfo.ParentFolderPath & "NJ0*.DTA") because there are several files that start with NJ0 and end with .DTA
[Code]...
i want to delete some files but only if they aren't in use. What i did was a try/catch:
Try
My.Computer.FileSystem.DeleteFile(fileInfo.FullName)
Catch ex As Exception
End Try
but it seems that this method is very slow if i try to delete some files over network.
Is there an faster way to delete files? Is it faster to check first if an file is open? If yes, how can i check if an file is open?
In my application,I have some reports which needs to be viewed frequently.After viewing the reports many times by different users, it shows load error.For different systems, many temporary files are created.i need to delete those files in my single system.now i manually deleting all the temporary files in the temp directory and configure the IIS again.then the report loads properly.But we need to delete these temporary files frequently which makes our life dreadful.Only the report files needs to be deleted.How can i delete these temporary files automatically using code? I have used the following code for this.but some files cant be deleted as those files are in use.Do those temporary files in other system can cause load error in our system?
dim temp as string=Environment.GetEnvironmentVariable("TEMP")
dim k as sting()=System.IO.Directory.GetFiles(temp)
dim i as integer[code].....
I need a code to find all files. mp3 on your hard disk with certain tags (eg: Shakira, Pitbull, 50 Cent, etc.). and then delete it.
Try
For Each f In Directory.GetFiles("D:", "*.mp3", SearchOption.AllDirectories)
File.Delete(f)
[code].....
I need a code to find all files. mp3 on your hard disk with certain tags (eg: Shakira, Pitbull, 50 Cent, etc.). and then delete it.
View 2 RepliesI created a program that allows my users to upload files to an FTP server and make folders. I have one problem. they cant delete the files yet. [url] you want to see the Upload page just enter random credentials). I was wondering if someone can help me make another form that displays files and folders and subfolders, maybe a listbox and when a user highlights something and clicks the delete button it will delete it or the rename button.
View 12 RepliesMy app lets you download backup files from the Internet and save them locally.I want the app to be able to automatically delete old backups though. What's the best way to do this?So if I allow the user to store five files named:
backup-03-03-2009.zip
backup-04-03-2009.zip
backup-05-03-2009.zip
[code]....
I'm trying to delete all files in a folder which start with a specific user id so if the user id = 00000 then i want to delete file 00000-1.xml & 00000-2.xml & 00000-3.xml and so on.I have this code so far
Dim path as String = Server.MapPath("../myfolder/xml/00000" & something?? & ".xml")
If path <> "" Then
Dim fileInfo As FileInfo = Nothing[code]....
Obviously I have just added the something?? in as i have no idea what to put there?
I'm working out on a function in my program to let it update all the downloaded files by a button, I tried this:
[code]...
But when I try it .. It says that I cannot remove the directory because it already has files inside it.My question is, how can I remove all these files together (Without mentioning each one of them because they're about 100 files) so I can be able to delete the directory?
I'm trying to read a csv file. I'm also try to delete all files in the temp directory on the page load. Everything goes fine the first time, but the second time I get an error saying it couldn't delete the file because it is in use by another process. I'm aware that this process is my vb file, I just can't seem to find what I need to dispose of to get rid of the file lock.
Here is my code
Imports System
Imports System.Web
Imports System.Web.UI.HtmlControls
Imports System.IO
Imports System.Xml
[Code] .....
I wonna delete/create directorys on the FTP server and delete files. i have used my.computer.network.upload/downloadfile but i cant do much more whit that ..
View 5 Replies