Delete A File
when the user clicks on a command button, the program deletes a certain file? --Ant--------------------------------------------------check out my newest freewareE-mail me at: cgeorge@thevortex.comfor the address
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
Getting File Properties,delete And Move File Keyword
Hi,
q1
how do i get the properties of a file..
lets say the name of the file is test1.xls, how do i get info such as the modified date,created date,size of file..
q2
i tried to delete a file using this command
fso.deletefile "c: est1.xls"
i also used
fso.movefile "c: est1.xls", "d: est1.xls" to move file to a different location
both statement returned an error saying access denied..not sure whats the real cause
thankxx in advance..
[VB6] Read In A File Delete Text And Write File
I have a tab delimited text file that I need to read in, remove text up to and including the first CR/LF and then write the remaining text back out to a file.
In the example file below, the first CR/LF is after 20080513 (although that number could be different). The file always starts with the word "Report". As an example, what I need to do in the file below is read the file in, remove the first line up to and including the CR/LF (which in the case below is Report Executed at Mon May 14 20:28:24 CDT 2007 for dates between 20070315 and 20080513 ) and then write the remainder of the file back out to another file.
Here is an example of the tab delimited file: (sample.txt)
Report Executed at Mon May 14 20:28:24 CDT 2007 for dates between 20070315 and 20080513
WRIDTTNASGN GROUPWCOOSJOBTYPETZCOMM_DTTMRPT_DTTMLOAD_START_DTTMLOAD_END_DTTMSOURCESTATUSBUCKET
5036884471089GA_Atl_NORTHEAST_D404295MRDLCTEASTERN20070316 23:5920070316 09:2420070316 00:0120070316 00:01LMOSPENDINGNONDEMAND
50398881236676GA_W_ROME_NEWNAN_PC770408MRMIFTEASTERN20070319 23:5920070319 04:5620070319 00:0120070319 00:01LMOSPENDINGNONDEMAND
50398885236800GA_W_ROME_NEWNAN_PC770400MBCTRTEASTERN20070319 23:5920070319 04:5720070319 00:0120070319 00:01LMOSPENDINGNONDEMAND
50398886236831GA_W_ROME_NEWNAN_PC770400MBCTRTEASTERN20070319 23:5920070319 04:5720070319 00:0120070319 00:01LMOSPENDINGNONDEMAND
50422929261569GA_W_ROME_NEWNAN_PC770400MRMIFTEASTERN20070320 23:5920070320 04:5120070320 00:0120070320 00:01LMOSPENDINGNONDEMAND
50489568333675GA_W_ROME_NEWNAN_PC770400MBCTRTEASTERN20070323 23:5920070323 04:5620070323 00:0120070323 00:01LMOSASSIGNNONDEMAND
Thanks in advance for your help...
Delete This File - If It's There - Help?
I have a button set to "Kill" (Delete) a file
called temp.html. The button works fine if the
file exists (it is usually written by another
button.) But if its not there, I get a runtime
error and the program ends.
What can I add to the button's code to
give some sort of error and not end the program
if the file is not there.
Code currently reads:
Kill "C:Program FilesLink Creator emp.html"
MsgBox "Old Temp.html File Has Been Deleted. You May Now Create A New One", vbOKOnly, "Insert A Program Name Here"
Delete File
hello,
I've a problem with an aplication. with the program I made, I can read ASCI files (txt, ini, cfg, ...) , an make changes to it. when I open a file, the aplication creates imediatly a .bak file. But when the user doesn't save the file he is working on, the .bak file needs to be deleted.
but I just don't know how to delete the .bak file! Can anyone help me?
Delete A File?
Is it possible to delete a file (e.g. a Word doc) using VB?
The reason I'm asking is I'm having a headache when overwriting a password protected doc, and think it would be easiest if the doc were simply deleted before I tried to save the new one.
Please help!
I Cant Delete This File...
I have a file on a network drive which I cannot delete - nothing else is using it - how can I terminate it?
J
Delete File
ok well i made a program updater it downlaods the file in the name of filename new
this is the code
DownloadFile "I-Nip Basic.exe", "I-Nip Basic New.exe"
If Dir("I-Nip Basic.exe") <> "" Then Kill ("I-Nip Basic.exe")
FileCopy App.Path & "I-Nip Basic New.exe", App.Path & "I-Nip Basic.exe"
If Dir("I-Nip Basic New.exe") <> "" Then Kill ("I-Nip Basic New.exe")
but when it tryes to delete the file I-Nip Basic.exe it gives an access error the file is running and needs to stay running while it does this can some one polease fix up my code
How Do I Delete A File?
Argh! I can't find a clear answer for this. I know I need to use the FileSystemObject to do this, but I have no idea what the syntax is supposed to be. If you can help me, assume that the file I want to delete is "C:Testmyfile.txt"
Thanks!
Delete File
i had the code somewhere but i was wondering what the easiest way to delete a file would be.
elbow deep within the boarder line. show me that you love me and that we belong together.
File Delete
Code:
If FileLen("C: emp" & lstSwfs.List(x)) > 0 Then
VBA.FileSystem.Kill ("C: emp" & lstSwfs.List(x))
End If
This works if the file exists, if the file doesn't exist on the hard drive, it errors out with File Not Found...how do I make this work? Basically I want it to delete said file if its there.
Can't Delete File
I am having problems deleting(kill) a file stored on a network folder (which I have mapped up on my workstation). If I try to run the kill on the file I get an exception saying "unauthorized access", but if I use the file explorer I can delete the file just fine. Which possible sources of error is there? I am sure no one has the file open.
kind regards
Henrik
How Do You Delete A File?
what is the syntax for deleting a file, and how do you delete a specific type of file (exe , jpg)? thanx
Delete A File
how do you del a file cuz im working on a program that deletes all cookies and history and cache and all that, kinda like evidence eliminator
Delete File From Reg
Hello,
i have a problem the following code saves to the registery.
Code Code:
Private Sub cmdRegister_Click()
If Len(txtRegister.Text) > 25 Then
If fnCheckRegistration(txtRegister.Text) = True Then
fnDoRegister "SOFTWAREProductRecoveryPRK", txtRegister.Text
frmMain.Show
Unload Me
Else
frmMessage.Show vbModal
Registered = False
End If
Else
frmMessage.Show
End If
End Sub
i was woundering if anyone can tell me how to delete it from the registry by clicking a command button?.
To Delete .xml File
There is an xml file that i have to delete using VB
Dim fso as FileSystemObject
fso.deletefile "C:CatalogC7Cat-27-06New Text Document.txt"
I am not able to use this DeleteFile function for .xml File. Is there any way to handle this?
How To Delete The File?
It is possible to delete the file inside the folder C:ProjectData through VB? Have a sample to see?
Delete A File
Hello,
i want to delete my database using Kill App.Path & "pcdb.mdb"
but the error message cmoes "ACCESS DENIED"
the full code is :
Private Sub CmdRestore_Click()
If Db.State = 1 Then
Db.Close
End If
SetAttr App.Path & "Pcdb.mdb", vbNormal
Kill App.Path & "pcdb.mdb"
If Db.State = 0 Then
On Error GoTo PerErr
FileCopy Direc & "" & FileName, App.Path & "pcdb.mdb" '& Format(Date, "dd/mm/yyyy") & ".mdb"
MsgBox "Restore completed ", vbInformation, "Restored"
SetAttr App.Path & "Pcdb.mdb", vbHidden
PerErr: 'Access Permission (If Database is in use)
If Err.Number = 75 Then
MsgBox "Database is in use. Unable to create backup", vbCritical, "Database is in use"
Exit Sub
End If
End If
End Sub
please help me
Delete From Txt File
what is the perfect way from deleting text from a .txt file.
for example when we write in .txt file we write the following code..
Code:
Open "c:file.txt" For Append As #1
Print #1, Text1.Text
Close #1
how can i delete the text from .txt file... i mean i don't want to delete that. but i want .txt to remain empty...
How Do You Delete A File In Vb6?
Hey guys,
I am writting a program that is moving a file to a certain directory (lets say "C:
ew folderpicture.jpg")
I want the program to check to see if that jpg exists. If it does, delete it then move a picture from "c:filespicture.jpg" to "C:
ew folderpicture.jpg".
I know this is easy, but I do not know the command to delete a file. thank you in advance.
Delete A File
Hi
How can I delete programmatically files from a specific folder
For example, i want to delete dailynews.doc from a folder(C:collection)
How can I do it?
Thanks
Cannot Delete Exe File
Guyz
I cant delete my exe file. There's an error saying: It is write protect or it is still being used. But I close it in my VB.
Thanks...
Delete A File
Cn u give me a function to delete a file from a folder given that filename and folder name are specified
Delete A File Using VB?
I'm trying to delete a reusable file in a VB6 app. This file is for importing information into a seperate Access DB and will be used multiple times. Should I delete it using the kill command like this(which doesn't work right now)-
Pathway = App.Path
FullPath = Pathway & "ImportFile.txt"
If FullPath <> 0 Then
Kill FullPath
End If
Or should I just overwrite the data in the file(which I doon't know how to do).
John
How To Delete A File
i know hw t save a file and load a file but i dont know hw to delete a file
how would i delete a specific file?
Delete File's On C:\
Hi guys, I'm new here and I'm starting out coding in VB. I was just wondering if there is code that make it so that when you click a button it clears your harddrive/or delete's files. I want to make like a quick formater for my old computer, and I wanna be destructive with it. Thanks!
How To Delete File In Vb
when I compiled using vb, it show "user defined type not found!"
thanks
VB Code:
Dim fso As New FileSystemObjectfso.deletefile ("c: emp emp.txt")
How To Delete File In Use
Hi everyone..
How to delete a file which is in use? actually i want to move a file which is in use by another process... is that possible? any ideas are welcome.. including API solution..
Delete From A Dat File
Can anybody help me please, im trying to get the following code to work, so for example when i click the cmdDelete command button it should remove the text you choosed from the listbox and other stuff out the .dat file and when you load it back up again it should be reoved. Can anybody help me please.
VB Code:
Private Sub cmdDelete_Click()On Error Resume Next Dim oldID As IntegerDim ThisTemp As IntegerDim tmpID As IntegerDim fpTemp As String If MsgBox("Are you sure that you want to delete this record!", vbYesNo, Title:="Road to Glory") = vbNo Then Exit SubElse 'set variables tmpID = 1 'sets the temp id as 1 locateStable lstStables.Text 'gets ID number of wrestler being removed fpTemp = App.Path + "DataStables.tmp" 'sets temporary file path Close gThisFile gThisFile = FreeFile 'sets ThisFile as first open file number Open gFileName3 For Random As gThisFile Len = Len(gStables) 'opens wrestler file for input ThisTemp = FreeFile 'sets ThisTemp as first open file number Open fpTemp For Random As ThisTemp Len = Len(gStables) 'opens temporary file for output For oldID = 1 To gLastRecord3 'loops through the number or wrestlers (records) If oldID <> gDatid3 Then 'if oldID does not equal datId then Get #gThisFile, oldID, gStables 'gets wrestler's info from file gPromotion.ID = tmpID 'gives wrestler a new id number Put #ThisTemp, tmpID, gStables 'saves wrestler into the temporary file tmpID = tmpID + 1 'increase the tmp id by 1 End If Next oldID 'continues the loop Close #ThisTemp 'closes the temporary file Close #gThisFile 'closes the wrestler file 'delete the old file and replace it with the tmp file gLastRecord3 = tmpID 'sets numWrestler as new number of wrestlers Kill (gFileName3) 'deletes the wrestler file Name fpTemp As gFileName3 'renames the temp file as the wrestler file 'Update the value of the last record gLastRecord3 = gLastRecord3 - 1 'Shows the record number in the label lstStables.Clear LoadStables_Sorted lstStables If lstStables.List(0) = "" Then lstStables.RemoveItem (0) End If lstStables.Selected(0) = TrueEnd If If lstStables.ListIndex = -1 Then txtName.Text = "" cboPromotion.Text = "" lstMembers.Clear lblLeader.Caption = "" cboAlgin.Text = ""End If End Sub
Delete A Dll File In Use?
Is there a way to delete a dll file thats in use?
I have a spyware dll in my system32 folder thats in use so hence i cant delete it . So is there a way around this or some utility for doing this?
Delete A File?
is it possible to delete a file uder a command button.
have a digalog box where they find the file, click ok and then it deletes from their computer.
any help appreciated
Delete From A .txt-file
hi,
i know how to write to, and read from a .txt-file, but how do i delete the contents of the file??
thanx in advance
splazz
Delete A File
How can i delete a file from mi HDD withot a confirmation usig a vb program?
(Simple Question for a stupid boy like me!)
THANKS for comming back VBForums.com!
Delete File
I check if a file is empty or not based on bytes. If it is empty I want to delete it. But I keep getting permission denied when it tries to delete it...and there is no security on the file:
Dim fs As Object
Dim a As Object
Dim Days As Long
Dim pathNameStr As String
Set fs = CreateObject("Scripting.FileSystemObject")
pathNameStr = "C: est est.txt"
Set a = fs.CreateTextFile(pathNameStr, True)
a.WriteLine
If FileLen(pathNameStr) = 0 Then
'empty text file
'just delete it
fs.DeleteFile pathNameStr
Else
'dont delete it...an error has occured
End If
Why doesnt this work? I want to delete a file that contains no text.
Delete Many File
Please help me,
i want to delete a number of files named :124512,124518,124524...
can u tell me how to delete that files?
Delete A File
Hi,
In my application, I want to delete a file in a directory. How do I do that?
Thanks.
How Do You Delete A .txt File?
I have the following code, what i want to do is after I do stuff with this data, I need to delete these files, because they are useless. The code below creates a variable number of .txt files but then how do i delete them?
s = 0
For data = 1 To (Stations - 1)
dummy(s) = "dummy" & s & ".txt"
Dim Handle As Integer
Handle = FreeFile()
Open dummy(s) For Output As #Handle
Close #Handle
s = s + 1
Next
Thanks,
Jeff
Delete File
how write a program dat delete file such as dll... in windows folder plz help
How Can I Delete The Exe File Of My APP?
well! I tried to, but the file is being read and therefore I don't have permission to delete it. How can I delete the exe file of my app then?
I tried to put the code in the Terminate event, but that didn't work
Delete A File
Hey Heres an easy one
To open a file i would do
shell ("c:file.txt")
How would i delete that file?
Delete File
It happens when my program downloads a small text file if there is already this file in the temporary internet folders it takes that one and doesn't download the new one. Fo example if the old file is 1.53 and the new one is 1.54 it doesn't donload it because it's the same len it just takes from the temp folder.
how can i have it force download?
Or how can i delete a file from the temp directory, withou hardcoding the directory name, or using a bunch of code?
|