[futurebasic] Re: moving a folder

Message: < previous - next > : Reply : Subscribe : Cleanse
Home   : December 2000 : Group Archive : Group : All Groups

From: Michael Evans <michael_evans@...>
Date: Thu, 28 Dec 2000 11:02:53 -0500
Thanks to all who replied.

For anyone who might be interested I renamed FN Move1File% as FN Move1Item%
and rewrote it slightly: (watch out for e-mail induced line breaks...)

'===========================================================================
CLEAR LOCAL MODE
DIM WDPBRec.WDPBRecSize, Err%
'===========================================================================
LOCAL FN GetWDDirID (WDRefNum%, @VolRefNumPtr&, @DirIDPtr&)
WDPBRec.ioVRefNum%  = WDRefNum%
Err% = FN GETWDINFO (@WDPBRec)
% VolRefNumPtr& , WDPBRec.ioWDVRefNum%
& DirIDPtr&     , WDPBRec.ioWDDirID&
END FN = Err%

'===========================================================================
CLEAR LOCAL MODE
LOCAL FN Move1Item%(SrcWD%, SrcItemName$, DstWD%)
'===========================================================================
'_cMovePBRecSize =             52
DIM MovePBRec.cMovePBRecSize, Err%
DIM @ SrcVolRefNum%, SrcDirID&
DIM @ DstVolRefNum%, DstDirID&
dim @ DstFldrName$
/*

moving a folder:
SrcWD%           = the wdrefnum of the folder containing the folder to be
moved
SrcItemName$     = the name of the folder to be moved (no trailing colon
":")
DstWD%           = the wdrefnum of the folder to where you want to move
SrcItemName$
DstFolderName$   = ":"

moving a file:
SrcWD%           = the wdrefnum of the folder containing the file to be
moved
SrcItemName$     = the name of the file to be moved
DstWD%           = the wdrefnum of the folder to where you want to move
SrcItemName$
DstFolderName$   = ":"

NOTE: FN Move1Item% works ONLY on items that reside on the SAME volume...

RESULT CODES
_noErr 0 No error 
_nsvErr -35 No such volume
_ioErr -36 I/O error
_bdNamErr -37 Bad filename or attempt to move into a file
_fnfErr -43 File not found
_wPrErr -44 Hardware volume lock
_fLckdErr -45 Target directory is locked
_vLckdErr -46 Software volume lock
_dupFNErr -48 Duplicate filename and version
_paramErr -50 No default volume
_badMovErr -122 Attempt to move into offspring
_wrgVolTypErr -123 Not an HFS volume
_afpAccessDenied -5000 User does not have the correct access to the file
*/

DstFldrName$ = ":"
Err% = FN GetWDDirID (SrcWD%, SrcVolRefNum%, SrcDirID&)
LONG IF Err% = _NoErr
Err% = FN GetWDDirID (DstWD%, DstVolRefNum%, DstDirID&)
LONG IF Err% = _NoErr
LONG IF SrcVolRefNum% = DstVolRefNum%
MovePBRec.ioNamePtr&   =@SrcItemName$
MovePBRec.ioVRefNum%   = SrcVolRefNum%
MovePBRec.ioDirID&     = SrcDirID&
MovePBRec.ioNewName&   =@DstFldrName$
MovePBRec.ioNewDirID&  = DstDirID&
Err% = FN CATMOVE (@MovePBRec)
XELSE
Err% = _BadMovErr
END IF
END IF
END IF

END FN = Err%

Cheers,

----------------------------------------------------------------------------
Michael Evans
3301 Wood Valley Road, NW * Atlanta, GA, 30327-1515
Voice: (404) 846-9386 * Cell: (404) 229-3930
Fax: (404) 240-0878 €
E-mail: michael_evans@...
----------------------------------------------------------------------------