Here's something I cooked up while waiting for a convert-program running:

It uses the SHFileOperation API which is also used when dragging files from
one folder to another in winexplorer. 

Regards,
Sietse Wijnker

***********************************************************
*- Defines for the SHFILEOPSTRUCT.wFunc
#Define FO_MOVE 0x0001
#Define FO_COPY 0x0002
#Define FO_DELETE 0x0003
#Define FO_RENAME 0x0004

*- Defines for the SHFILEOPSTRUCT.fFlags
#DEFINE FOF_ALLOWUNDO 0x0040
#DEFINE FOF_CONFIRMMOUSE 0x0002
#DEFINE FOF_FILESONLY 0x0080
#DEFINE FOF_MULTIDESTFILES 0x0001
#DEFINE FOF_NOCONFIRMATION 0x0010
#DEFINE FOF_NOCONFIRMMKDIR 0x0200
#DEFINE FOF_NOCOPYSECURITYATTRIBS 0x0800
#DEFINE FOF_NOERRORUI 0x0400
#DEFINE FOF_RENAMEONCOLLISION 0x0008
#DEFINE FOF_SIMPLEPROGRESS 0x0100

*- Declare the needed DLL's
Declare Integer SHFileOperation In Shell32 ;
        String @lpFileOp
DECLARE Long GlobalAlloc IN WIN32API Long, Long
DECLARE Long GlobalFree IN WIN32API Long

lcFrom = "D:\SourceFolder\*" + CHR(0) + CHR(0)
hGlobalFrom = GlobalAlloc(0x0040, LEN(lcFrom))
SYS(2600, hGlobalFrom, LEN(lcFrom), lcFrom)

lcTo = "\\xpsrv1\targetfolder\" + CHR(0) + CHR(0)
hGlobalTo = GlobalAlloc(0x0040, LEN(lcTo))
SYS(2600, hGlobalTo, LEN(lcTo), lcTo)

lcTitle = "Copy FILE(s)..." + CHR(0) + CHR(0)
hGlobalTitle = GlobalAlloc(0x0040, LEN(lcTitle))
SYS(2600, hGlobalTitle, LEN(lcTitle), lcTitle)

Local shFileOp As String && SHFILEOPSTRUCT
lnFlag = FOF_CONFIRMMOUSE ;
        + FOF_NOERRORUI ;
        + FOF_RENAMEONCOLLISION ;
        + FOF_MULTIDESTFILES ;
        + FOF_SIMPLEPROGRESS ;
        + FOF_NOCOPYSECURITYATTRIBS ;
        + FOF_NOCONFIRMMKDIR ;
        + FOF_NOCONFIRMATION
shFileOp = BinToC(_vfp.HWnd, "4RS") + ;
        BINTOC(FO_MOVE, "4RS") + ;
        BINTOC(hGlobalFrom, "4RS") + ;
        BINTOC(hGlobalTo, "4RS") + ;
        BINTOC(lnFlag, "2RS") + ;
        CHR(0) + CHR(0) + CHR(0) + CHR(0) + ;
        CHR(0) + CHR(0) + CHR(0) + CHR(0) + ;
        BINTOC(hGlobalTitle, "4RS")
        
IF SHFileOperation(@shFileOp) = 0
        ?"files copied!"
ELSE
        ?"Error while copying..."
ENDIF

GlobalFree(hGlobalFrom)
GlobalFree(hGlobalTo)
GlobalFree(hGlobalTitle)

**********************************************************

> -----Original Message-----
> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] On Behalf Of Nick
> Sent: donderdag 31 augustus 2006 22:10
> To: [EMAIL PROTECTED]
> Subject: RE: Move directories
> 
> Chet wrote:
> 
> > I think he's trying to do it in a VFP program...?
> 
> Exactly, there are a few thousand directories, moving each 
> one manually might take some time ;)
> 
> 
> stephen.russell wrote:
> > 
> > why not xcopy /E to include all the empty folders as well as all 
> > folders with files?
> 
> Because we don't want the whole lot moved only a selection of 
> them; those that have a certain string (year) in their name.
> 
> 
> Lew Schwartz wrote:
> > 
> > Fox's rename will move files across drives, but you'll have 
> to handle 
> > the directory structures with adir(<AA>,<path+*.*>,"D") & md. 
> > (Currently working on a fox version of xcopy).
> 
> Fox version of XCopy would be _extremely_ interesting.
> 
> 
> Rgds,
>       Nick
> 
> 
> 
[excessive quoting removed by server]

_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/profox
OT-free version of this list: http://leafe.com/mailman/listinfo/profoxtech
** All postings, unless explicitly stated otherwise, are the opinions of the 
author, and do not constitute legal or medical advice. This statement is added 
to the messages for those lawyers who are too stupid to see the obvious.

Reply via email to