Chat LIVE With Programming Experts! There Are 23 Online Right Now...

Welcome to Dream.In.Code
Become a VB Expert!

Join 244,218 VB Programmers for FREE! Get instant access to thousands of VB experts, tutorials, code snippets, and more! There are 1,450 people online right now. Registration is fast and FREE... Join Now!




Kill hidden files

 
Reply to this topicStart new topic

Kill hidden files

benpap
6 Dec, 2007 - 03:28 AM
Post #1

New D.I.C Head
Group Icon

Joined: 24 Nov, 2007
Posts: 47


Dream Kudos: 100
My Contributions
Helle there, I have question to make. You all know the kill command, I am testing it to gain experience on VB, because I am still a begginer. I opened a new form with just 2 objects, a text object (txtkilltarget) and a command button (cmdkill). So, the user enters a path and can kill a file with the command button. So far so good, all works fine but what if the target file is hidden? It doesn't find the file so it can't kill it. What can I do about it? Can I somehow make the file first visible, if hidden, and then kill it or even better let the cmdkill know that it is hidden so it finds it somehow and then kills it. Here is my code:
vb
 
Private Sub cmdkill_Click()
On Error GoTo NotFound
Kill txtkilltarget.Text
GoTo TheEnd
NotFound:
MsgBox "An error occured, check if file destination is correct."
TheEnd:
End Sub


User is offlineProfile CardPM
+Quote Post


born2c0de
RE: Kill Hidden Files
9 Dec, 2007 - 05:26 AM
Post #2

printf("I'm a %XR",195936478);
Group Icon

Joined: 26 Nov, 2004
Posts: 4,353



Thanked: 81 times
Dream Kudos: 2800
Expert In: J2ME, 80x86 Assembly, C/C++, VB6, VB.NET, C#, J2SE, Win32 API, Reversing

My Contributions
Just change the attributes of the file using the SetAttr() function and then delete it like this:
vb
SetAttr "<filename>", vbnormal
Kill "<filename>"

User is offlineProfile CardPM
+Quote Post

benpap
RE: Kill Hidden Files
12 Dec, 2007 - 10:56 AM
Post #3

New D.I.C Head
Group Icon

Joined: 24 Nov, 2007
Posts: 47


Dream Kudos: 100
My Contributions
How to Kiil a hidden file ph34r.gif ? What does someone have to add in the following code:
CODE
Kill "C:\file.bat"
(the bat file is hidden), if i use the shell command then it works fine. blink.gif
User is offlineProfile CardPM
+Quote Post

no2pencil
RE: Kill Hidden Files
12 Dec, 2007 - 11:06 AM
Post #4

Unix Ronin
Group Icon

Joined: 10 May, 2007
Posts: 10,438



Thanked: 198 times
Dream Kudos: 2725
Expert In: Goofing Off

My Contributions
QUOTE(benpap @ 12 Dec, 2007 - 11:56 AM) *

How to Kiil a hidden file ph34r.gif ? What does someone have to add in the following code:
CODE
Kill "C:\file.bat"
(the bat file is hidden), if i use the shell command then it works fine. blink.gif

If a file is hidden, try using attrib to unhide it, then kill it.


User is offlineProfile CardPM
+Quote Post

born2c0de
RE: Kill Hidden Files
12 Dec, 2007 - 10:06 PM
Post #5

printf("I'm a %XR",195936478);
Group Icon

Joined: 26 Nov, 2004
Posts: 4,353



Thanked: 81 times
Dream Kudos: 2800
Expert In: J2ME, 80x86 Assembly, C/C++, VB6, VB.NET, C#, J2SE, Win32 API, Reversing

My Contributions
I have answered your question in the previous thread that you had created.
If you couldn't find your original post, use the Search Box in the top-right corner of any page.

Topics Merged.
User is offlineProfile CardPM
+Quote Post

Fast ReplyReply to this topicStart new topic

Time is now: 7/4/09 08:17AM

Live VB Help!

Be Social

Dream.In.Code RSS Feed Dream.In.Code LinkedIn Group Follow Us On Twitter Fan Us On Facebook

VB Tutorials

Reference Sheets

VB Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month