473,657 Members | 2,659 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Delete file

Hello,

I am making a program that will not have an user interaction to delete
certian files. I found this line of code.
My.Computer.Fil eSystem.DeleteF ile("C:\POLLJP. DWN",
FileIO.UIOption .AllDialogs, FileIO.RecycleO ption.DeletePer manently)
The problem is that a message box comes up and asks "Are you sure you
want to delete file"file name yes or no". Does anyone know a way
around this. I want it to delete everytime no questions asked .Thank
you
Jun 27 '08 #1
4 4093
On Jun 10, 11:03*pm, id10t error <tubbz...@gmail .comwrote:
Hello,

I am making a program that will not have an user interaction to delete
certian files. I found this line of code.
My.Computer.Fil eSystem.DeleteF ile("C:\POLLJP. DWN",
FileIO.UIOption .AllDialogs, FileIO.RecycleO ption.DeletePer manently)
The problem is that a message box comes up and asks "Are you sure you
want to delete file"file name yes or no". Does anyone know a way
around this. I want it to delete everytime no questions asked .Thank
you
That's because you're passing FileIO.UIOption enum as "AllDialogs "
then simply change your code to:

My.Computer.Fil eSystem.DeleteF ile("C:\POLLJP. DWN",
FileIO.UIOption .OnlyErrorDialo gs,
FileIO.RecycleO ption.DeletePer manently)

Thanks,

Onur Güzel

Jun 27 '08 #2
On Jun 10, 4:03*pm, id10t error <tubbz...@gmail .comwrote:
Hello,

I am making a program that will not have an user interaction to delete
certian files. I found this line of code.
My.Computer.Fil eSystem.DeleteF ile("C:\POLLJP. DWN",
FileIO.UIOption .AllDialogs, FileIO.RecycleO ption.DeletePer manently)
The problem is that a message box comes up and asks "Are you sure you
want to delete file"file name yes or no". Does anyone know a way
around this. I want it to delete everytime no questions asked .Thank
you
The File.Delete method does not present the user with a nag box. But I
am not sure if it can permanently delete the file.

I think the File class is in the System.IO namespace.
Jun 27 '08 #3
Or you could use the good old "Kill" command.
Kill "C:\POLLJP. DWN" will permanently delete that file.

On 11.06.2008 04:42, schrieb za***@construct ion-imaging.com:
On Jun 10, 4:03 pm, id10t error<tubbz...@ gmail.com wrote:
>Hello,

I am making a program that will not have an user interaction to delete
certian files. I found this line of code.
My.Computer.Fi leSystem.Delete File("C:\POLLJP .DWN",
FileIO.UIOptio n.AllDialogs, FileIO.RecycleO ption.DeletePer manently)
The problem is that a message box comes up and asks "Are you sure you
want to delete file"file name yes or no". Does anyone know a way
around this. I want it to delete everytime no questions asked .Thank
you

The File.Delete method does not present the user with a nag box. But I
am not sure if it can permanently delete the file.

I think the File class is in the System.IO namespace.
Jun 27 '08 #4
On Jun 10, 11:42*pm, za...@construct ion-imaging.com wrote:
On Jun 10, 4:03*pm, id10t error <tubbz...@gmail .comwrote:
Hello,
I am making a program that will not have an user interaction to delete
certian files. I found this line of code.
My.Computer.Fil eSystem.DeleteF ile("C:\POLLJP. DWN",
FileIO.UIOption .AllDialogs, FileIO.RecycleO ption.DeletePer manently)
The problem is that a message box comes up and asks "Are you sure you
want to delete file"file name yes or no". Does anyone know a way
around this. I want it to delete everytime no questions asked .Thank
you

The File.Delete method does not present the user with a nag box. But I
am not sure if it can permanently delete the file.

I think the File class is in the System.IO namespace.
As OP requests, with "DeleteFile " method in My namespace, a file can
be deleted permanently without any user interaction of confirmation,
except errors(see 2nd and 3rd parameters):

My.Computer.Fil eSystem.DeleteF ile("C:\POLLJP. DWN",
FileIO.UIOption .OnlyErrorDialo gs,
FileIO.RecycleO ption.DeletePer manently)

unless you try to recover with a recovery software of course :)

Thanks,

Onur Güzel
Jun 27 '08 #5

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

Similar topics

5
14148
by: Jobs | last post by:
Hello All, I want to delete all files in a directory. I am making a backup copy of all files in the directories say c:\abc by reading and writing to a file. After making a backup copy I want to delete these files. I am using following code: // get list of all files in the directories
0
2091
by: SeanR | last post by:
I have a function to copare two files. It will first copy the original file form a different server to a local temp path and then compare that version to a version that has been restored form tape. Once the compare is complete the file that was copied to a temp location needs to be deleted. I am using the method file.copy(sourcePath, tempPath, true) to copy the file and then file.delete(tempPath) to delete the file. On some of the files...
5
5234
by: | last post by:
Hi all, I've been using C++ for quite a while now and I've come to the point where I need to overload new and delete inorder to track memory and probably some profiling stuff too. I know that discussions of new and delete is a pretty damn involved process but I'll try to stick to the main information I'm looking for currently. I've searched around for about the last too weeks and have read up on new and overloading it to some extent but...
23
8935
by: da Vinci | last post by:
Greetings, Onwards with the school studying. Working on a program and need to delete a file from a known location on the hard drive but cannot get anything I do to work. I have tried to use the remove function that is included with <cstdio> but cannot get it to work properly. My reference book has the following....
12
7989
by: Lucas Tam | last post by:
I have a very simple loop: If (Directory.Exists(tempDirectory)) Then Try Dim Files() As String = Directory.GetFiles(tempDirectory) 'Clear out directory For Each Filename As String In Files File.Delete(Filename) Next Catch ex As Exception
9
8330
by: Paul | last post by:
I'm trying to make get my app to delete all the files in a specified folder and all the files within the folders of the specified folder. e.g. Folder 1 contains three files (File1, File2, File3) and two folders (Subfolder 1, Subfolder 2). .......I need to delete File1, File2, File3. Subfolder 1 contains FileA. .......Need to delete FileA. Subfolder 2 contains FileB, FileC, FileD.
2
4743
by: createdbyx | last post by:
I am trying to make a file sync utillity to sync files between my laptop and my desktop pc. On my desktop machine (xp pro sp2) I have shared my "Visual Studio Projects" folder using windows simple file sharing. And have specified the "Allow network users to change my files." option as well. Then on my laptop (xp home sp2) I have mapped a network drive using windows explorer. So on my laptop I have a Y: drive that points to the "Visual...
5
38991
by: wo20051223 | last post by:
Deleting some files with C# fails with "Access to the path 'X' is denied". I have files copied from a CD that I burned (and not locked by a process) and a text file that I created in Windows Explorer. I can delete all of them through Windows Explorer. I can programmatically delete the text file but not the others. Permissions: - All files have the same ACL.
3
3275
by: Arpan | last post by:
A Form has a FileUpload, 2 Buttons & a TextBox web server controls. Using the FileUpload control, I want to give users the provision to move & delete files that DO NOT exist in C:\Inetpub\wwwroot (i.e. the root directory). This is the code: <script runat="server"> Sub MoveFile(ByVal obj As Object, ByVal ea As EventArgs) File.Move(fudFileSource.FileName, txtFileDest.Text) 'File.Move("F:\4.jpg", "C:\4.jpg") End Sub
7
4219
by: Anil Gupte | last post by:
Private Sub mnu2Exit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mnu2Exit.Click Dim fDir As String = Path.GetDirectoryName(L3Global.VideoFileName) File.Delete(L3Global.VideoFileName) ' The following is not working - reports directory not empty exception ' Directory.Delete(fDir)
0
8385
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8602
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7316
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5632
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4150
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4300
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2726
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 we have to send another system
2
1941
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1601
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.