Re: [BLACKBOX] Deleting a directory

From: [at]} <Aubrey.McIntosh{>
Date: Thu, 9 Dec 2010 18:56:35 -0600


Just for practice, I coded this up.

StdCoder.Decode ..,1 ..x.....VeQHfRTNHT9NT7F99P99R9f9T9N5Hc8rosInPPT7F99PUn
 pAVeQHXGRimRgjYcZZBEm.bI,...
 1Ak...vQ....58FTuPE,5TWyqlKrqKKrGrtumdGLmGorCquU2hgnRAXDFTvMUn7FTvMf1G2sET
 fPdPMHfP9fQbf9hOO9vR7ONbvMoedhgrRiioedFWUkTeoxhmhgnpZHZijJC7ONbvM0.,.S.WP1
 U.QklbcjRAktgdjZgZZh2hgnlsDor.kay4.qorGqmQiig76FUHZijJCbnWmqmqKWKqtcw7.,.B
 c,A,oz3U.2.8cIhgsZiKBhZxintId9NhOO9HWUlbeZ3Dkto8Y6cw3.0.k1EIL.2U18J99SqorG
 qmQCbWBxhYFWUl1UnNHEWUmr.0U.END.T.Jx.2U.2.Iq.U00.bnUGLu8ro8quGrmCLWKqtE0E.
 kNU.EBU.U,.JFkns.U.2m,.ri.E.c5Nf.OS28U0Cy2hgqRcjhhhBgiZgZJinpZHZCh0E.4TWKK
 v.Uio8.,cw5.0..oU.U.M3c2szPuH7OJNOF,7IZPOh9F99P99R9vCPM0HOHVuHZ8JPM0HcFH9P
 9vQN76b8R79HTvNN76jOORPEVPOrN1HM0PM05uHRuIdO1HM0ROMPPN,ND,d698SdfQ1f6rN1HM
 0oe,JeBAV7AhiZiZJiVRgoxBJ76p76ZOF5uHZ8F,7NHfQ9vMdvPaLJ0GR0mU8Jd4og0GNKHP0m
 bOIECIY4Id0mWuIWin4ak26IZuH5OF7OJZOF,7F99P9XeQbBA,hOEk2mqrCKEeHEOoomqmoZAx
 hXBgoxhmRbBA,HcNH9P99HHvQd96p76B0bHXaKqKqYuKnyqRqk2aUjZhY3Yu.C5MG.3OFDOGRO
 1HM0N1qHEOooman7NHfQR7JFPOb98HfPdPN.R7NHfQ91aLGamRq.B1N0gbU.b1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0E.cUOor8rqOpoKantId9NhOO9vR704TXyKt.bHfEWUmL.6..D.nu.6.,sUOor8bB
 xhYltQ8qorGqmY6Mw.sQq2Y6cwB.0.Rf.I,og0E.0E.E,RcjpBZvPNvQRtFZvPf9Q7ONbXlT6.
 CoruKuEWKqtcw5.0.N1,.d0,E00ZmNOOb2NNmaZ7RKaiMOuaoNN8bVtMGbjdQMO,cP...0E...
 obTHuin02d3Q37ekPE,5zV.CbEhin3h0hioZijph2hgnRAu.2.m30.G20U2.oCEqEuELY6YBYC
 2.7mmYBYC2.,6..4.2UyUywPupQjUqYf2cUX5.5OMV9RHvPR9F91.,Uy,,Ua3.2U2..YBYCo3H
 Hr.Z1.o37noIC9nl.ADYAH1..2U..M.E.mLT5Ug3r66xRv0mv3iU0Cy1,EXaqmmKmGomC5.,Ug
 V.UIV.6,.h1YBYCo3oBEtAA.o3.91.n10..4.2UYhaA6PlB0mQXaW6TUA6U2.E,p6QcjpB6P9f
 Qbf9b8RCoruKu.GomCb.Ay4,.sQRtET1U2V.sEMM.Et...ktu0.Y62Umb.2..k26.0U3.,c.16
 QBaywPW.0.161lbA2T8NinWCCnDcUXDF.sET1.UIU...W.0..0TAPbUKjN8Utj00MyfUkZnf76
 xfX.dg1...
 --- end of encoding ---

On Thu, Dec 9, 2010 at 5:23 PM, Robert <robert.campbell_{([at]})nowhere.xy


Thanks Chris

I have just (this second!) had an apparently successful experiment;

 VAR
   res : INTEGER;
   name : ARRAY 40 OF CHAR;
 BEGIN
  res := Api.RemoveDirectoryW ('C:\BlackBox\Fred')

seems to work ok (provided \\Fred is empty etc),

as does

  name := 'C:\BlackBox\Fred';
  res := Api.RemoveDirectoryW (name);



Thanks

Robert




On 09/12/2010 11:01 PM, Chris Burrows wrote:


-----Original Message-----
From: BlackBox [mailto:BLACKBOX{([at]})nowhere.xy
Sent: Friday, 10 December 2010 8:31 AM
To: BLACKBOX{([at]})nowhere.xy
Subject: [BLACKBOX] Deleting a directory

Hi,

I'm sure I've done this before, but have forgotten how (and where)!


To delete a File one calls

  Files.dir.Delete (loc, name$)

but how do you delete a directory?




One way you can do it is with a direct call to the Windows API:

  PROCEDURE DeleteDir*(IN name: ARRAY OF CHAR): BOOLEAN;
  BEGIN
    RETURN WinApi.RemoveDirectory(WinStr(name)) # 0
  END DeleteDir;

DeleteDir returns TRUE if the directory could be deleted (i.e. if it is
empty, has delete permissions etc.)


The tricky part is that the RemoveDirectory function requires a parameter of
type WinApi.PtrSTR. The following function returns a WinApi.PtrSTR given an
ARRAY OF CHAR. There might be a better way but it seems to work:

  PROCEDURE WinStr(IN x: ARRAY OF CHAR): WinApi.PtrSTR;
  VAR
    p: POINTER TO ARRAY OF SHORTCHAR;
  BEGIN
    NEW(p, LEN(x$) + 1);
    p^ := SHORT(x$);
    RETURN p^
  END WinStr;

Regards,
Chris

Chris Burrows
CFB Software
http://www.cfbsoftware.com


----
To unsubscribe, send a message with body "SIGNOFF BLACKBOX" to LISTSERV{([at]})nowhere.xy-----
No virus found in this message.
Checked by AVG - www.avg.com
Version: 10.0.1170 / Virus Database: 426/3305 - Release Date: 12/09/10
----
To unsubscribe, send a message with body "SIGNOFF BLACKBOX" to LISTSERV{([at]})nowhere.xy-- 
-- 
Aubrey McIntosh, Ph.D.
1502 Devon Circle
Austin TX 78723-1814
http://home.grandecom.net/~amcintosh/aubrey/Search/
---- To unsubscribe, send a message with body "SIGNOFF BLACKBOX" to LISTSERV{([at]})nowhere.xy
Received on Fri Dec 10 2010 - 01:56:35 UTC

This archive was generated by hypermail 2.3.0 : Thu Sep 26 2013 - 06:30:27 UTC