Removing files, SHFormatDrive

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
LVL 1
swdldAsked:
Who is Participating?
 
SpideyModConnect With a Mentor Commented:
per recommendation

SpideyMod
Community Support Moderator @Experts Exchange
0
 
KarcOriginCommented:
0
 
swdldAuthor Commented:
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
Cloud Class® Course: Microsoft Windows 7 Basic

This introductory course to Windows 7 environment will teach you about working with the Windows operating system. You will learn about basic functions including start menu; the desktop; managing files, folders, and libraries.

 
DanRollinsCommented:
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
 
swdldAuthor Commented:
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
 
DanRollinsCommented:
>>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
 
twalgraveCommented:
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
 
DanRollinsCommented:
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
 
SpideyModCommented:
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
 
twalgraveCommented:
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
 
DanRollinsCommented:
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
 
swdldAuthor Commented:
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
 
SpideyModCommented:
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
 
swdldAuthor Commented:
SpideyMod,

Thanx,

C.U.,
sdwld
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.