Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Consolidate files into a single folder
Message
From
17/07/2011 19:00:28
Victor Chignes
Inteliventas
Peru
 
 
To
17/07/2011 18:16:41
General information
Forum:
Visual FoxPro
Category:
Other
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Windows 7
Miscellaneous
Thread ID:
01518403
Message ID:
01518408
Views:
67
It worked great! Thank you very much
>Hi Victor, would you try this?
>
>
>CLEAR ALL
>SET SAFETY OFF
>
>CREATE CURSOR csrFiles (fname C(128))
>GetFilesInFolder("d:\myprojects\images")
>
>IF RECCOUNT("csrFiles") > 0
>  SELECT csrFiles
>  LOCATE
>  BROWSE NOWAIT
>  m.lcDir = GETDIR("","Folders:", "Select destination folder", 64)
>  IF !EMPTY(m.lcDir)
>    m.lcDir = ADDBS(LOWER(m.lcDir))
>    SCAN
>      IF JUSTEXT(fname) == "png"
>        COPY FILE (fname) TO (m.lcDir + CHRTRAN(SUBSTR(fname, 4), "\", "_"))
>      ENDIF
>    ENDSCAN
>  ENDIF
>ENDIF
>
>USE IN csrFiles
>
>RETURN
>
>PROCEDURE GetFilesInFolder(tcFolder)
>  LOCAL ARRAY laFiles[1]
>  LOCAL lnFileCount, lnIndex, lcFile
>  m.tcFolder = ADDBS(m.tcFolder)
>  m.lnFileCount = ADIR(laFiles, m.tcFolder+"*.*", "D", 1)
>  FOR m.lnIndex = 1 TO m.lnFileCount
>    m.lcFile = TRIM(m.laFiles[lnIndex, 1])
>    IF (AT("D", m.laFiles[lnIndex, 5]) > 0)
>      IF !INLIST(m.lcFile, ".", "..")
>        GetFilesInFolder(m.tcFolder + m.lcFile)
>      ENDIF
>    ELSE
>      INSERT INTO csrFiles VALUES (m.tcFolder + m.lcFile)
>    ENDIF
>  ENDFOR
>ENDPROC
>
>
>
>Regards,
>Ony
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform