Solved

Removing files, SHFormatDrive

Posted on 2002-03-26
14
290 Views
Last Modified: 2008-02-26
Hi you all,

Does anyone know how to perfom SHFormatDrive UNATTENDED?

My problem is, that my public FTP folder is used as public trash. Automately removing unwanted files (some are wanted and I know which) fails, because (not only) 'kill' is unable to remove hidden files, 'RmDir' seemed to be useless to remove subDirs if their names are only blanc spaces etc. etc.

A workaround may be to format the drive on which my FTP folder is located on (service of FTP publishing is stopped first). But I do not aggree to sit besides the server to press the 'OK' butten if it's needed to aggree with formatting...


Any hints are welcomed!

C.U.,
swdld
0
Comment
Question by:swdld
  • 4
  • 4
  • 3
  • +2
14 Comments
 
LVL 5

Expert Comment

by:KarcOrigin
ID: 6898175
0
 
LVL 1

Author Comment

by:swdld
ID: 6898986
Hi KarcOrigin,

thanx for your answer.
Searching the MSDN (for shure I did this before asking EE) brings 2 hits. One you posted but still I'm not shure how the example works, because I just know VB and no C.
In the MDSN listing ..
  SHFormatDrive (hMainWnd, 0 /* A: */, SHFMT_ID_DEFAULT, 0)
.. the second option "0 /* A: */" for me still is a big questionmark.
Next I don't know, why the last option is a "0", because I thought this option HAS TO BE "1" fix?
Could you please give me a hint on what to change in my code to get the formatting unattended?
Thanx.
Here is my code used for now:

'-------- begin of code --------

Private Declare Function SHFormatDrive Lib "Shell32.dll" (ByVal hWnd As Long, ByVal Drive As Integer, ByVal fmtID As Integer, ByVal Options As Integer) As Long
   
Sub Main()
   
   Dim lngRet&
   
   'OPTIONS:
   'Form1.hWnd is handle of the app's form1
   '5 means drive "F:"
   '1 means "short" format (deletion)
   '1 stands for future time options (not yet implemented?)
   
   lngRet = SHFormatDrive(Form1.hWnd, 5, 1, 1)
   
End Sub

'-------- end of code --------






C.U.,
swdld

0
 
LVL 49

Expert Comment

by:DanRollins
ID: 7637886
Hi swdld,
It appears that you have forgotten this question. I will ask Community Support to close it unless you finalize it within 7 days. I will ask a Community Support Moderator to:

    DELETE this question.

swdld, Please DO NOT accept this comment as an answer.
EXPERTS: Post a comment if you are certain that an expert deserves credit.  Explain why.
==========
DanRollins -- EE database cleanup volunteer
0
 
LVL 1

Author Comment

by:swdld
ID: 7650897
HI DanRollins,

in fact the formatting problem is not solved yet.
Your words sound like it would be possible to close a question by myself by "finalizing" it?
Is it right?
Could you please tell me how to do it by myself in futuretimes?

Thanx,

C.U.,
swdld,

0
 
LVL 49

Expert Comment

by:DanRollins
ID: 7653794
>>Your words sound like it would be possible to close a question by myself by "finalizing" it?

Yes, you can "finalize" this question by accepting one of the comments as an answer.  

If you do not wish to award points, you can request a deletion by making a post to Community Support and be sure to mention the Question ID #.  This question is in the queue for Moderator processing and it will be deleted within one week, so -- for this question -- you do not need to take any action.

-- Dan
0
 
LVL 16

Expert Comment

by:twalgrave
ID: 7754764
PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!

No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in Community Support that this question is:
- refund/PAQ
Please leave any comments here within the
next seven days.
0
 

Accepted Solution

by:
SpideyMod earned 0 total points
ID: 7811615
per recommendation

SpideyMod
Community Support Moderator @Experts Exchange
0
What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

 
LVL 49

Expert Comment

by:DanRollins
ID: 7814836
The reason I recommended DELETE is that the only expert comment is just a link, and that link does not provide an answer (at least not when I tried it then and not now).

Anyway, what's the deal with all of this second-guessing?  Surely there are plenty of questions that have had no previous analysis...  

-- Dan
0
 

Expert Comment

by:SpideyMod
ID: 7815835
Dan,
Please try to understand that different people see different levels of value in answers.  Apparently, this question was supposed to be scheduled for moderator action back in December or early Jan and either it didn't make it on a cleanup list or was overlooked in the cleanup process.  I agree that there are many questions that have not been addressed yet, but I've seen twalgrave's work on getting these questions cleaned up.  There's actually been very litle overlap.  Yesterday I spent 6 hours going over 7 lists which contained about 100 cleanup Qs each in the Visual Basic areas that twalgrave provided and saw very little of this.

twalgrave,
Please refrain from making recommendations where other cleanup volunteers have already done so.  If you come across more of these where it looks lie a recommendation has been made but should have been taken care of by a previous cleanup list, simply put a link in your list and move on to the next question.  Thanks for your cooperation.
 
Both of you,
We greatly appreciate the cleanup efforts that you have undertaken using your own time.  It is most valuable to this site.  I just want to extend a hardy thank you and to let you know you are making a big difference in the value of this site.

I will delete this question  when I receive feedback from both of you.

SpideyMod
Community Support Moderator @Experts Exchange
0
 
LVL 16

Expert Comment

by:twalgrave
ID: 7816339
SpideyMod,
Thanks for the info.  Will do that in the future. I'm ok with a deletion of this question and meant no harm.  I just thought there was good information provided by the questioner in the second comment that may be of use to someone else considering that MSDN only gives you two hits on the topic.  I'd like to try to keep egos out of the cleanup process, so I will provide cleanup recommendations elsewhere.

0
 
LVL 49

Expert Comment

by:DanRollins
ID: 7817198
My fragile ego has been damaged beyond repair :)

VB has perhaps the most need for cleanup, with more open questions than the next two combined -- this is after I have already processed 5000 of them.  I'm just saying there are plenty of open questions to go around, so there is no need to cover the same ground twice.

-- Dan
0
 
LVL 1

Author Comment

by:swdld
ID: 7817253
SpideyMod,
twalgrave,
DanRollins
and all the other boys hwo take care of the high quality level of this site:

Please note, that there unfortunately was no use in any answer postet to my question.

Meanwhile I figured out by myself, that there is a tool called "POSIX", contained within a Windows SDK, which is called by commandline and erases folders which are normally not to be handled by windows (containing blanc spaces etc.).

Please note, that loosing my points without getting any usable help will not give me a good feeling beeing a member at EE.

Thanx for refunding my points!

C.U.,
swdld

0
 

Expert Comment

by:SpideyMod
ID: 7818812
swdld,
Thanks for posting your solution.  I am convinced now that there's value to this question, so I will leave it PAQd.  
No problem on the points refund.  We are here to help.  Thanks everyone for helping to bring this to a successful conclusion.

SpideyMod
Community Support Moderator @Experts Exchange
0
 
LVL 1

Author Comment

by:swdld
ID: 7820198
SpideyMod,

Thanx,

C.U.,
sdwld
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

708 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now