Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

help speed up 1

Status
Not open for further replies.

foxup

Programmer
Dec 14, 2010
328
CA
Hi All,

I have this simple code which 'cleans up' a folder for me on q "Quit" command box. It takes very long to do. I'm pretty sure I'm doing the same twice in this code. Can you please help me speed it up.


*** STARTCODE ***

IF THISFORM.optiongroup1.ENABLED=.T. OR THISFORM.command3.ENABLED=.T.
CLOSE DATA
THISFORM.RELEASE

ELSE
CLOSE DATABASES
WAIT "Cleaning Up Files. Please Wait ..." WINDOW NOWAIT
COPY FILE "C:\QEnswitch\timegroups.tsv" TO "C:\QEnswitch\data"
COPY FILE "C:\QEnswitch\roles.tsv" TO "C:\QEnswitch\data"
COPY FILE "C:\QEnswitch\queues.tsv" TO "C:\QEnswitch\data"
COPY FILE "C:\QEnswitch\pickupgroups.tsv" TO "C:\QEnswitch\data"
COPY FILE "C:\QEnswitch\phones.tsv" TO "C:\QEnswitch\data"
COPY FILE "C:\QEnswitch\people.tsv" TO "C:\QEnswitch\data"
COPY FILE "C:\QEnswitch\pagegroups.tsv" TO "C:\QEnswitch\data"
COPY FILE "C:\QEnswitch\numbers.tsv" TO "C:\QEnswitch\data"
COPY FILE "C:\QEnswitch\mailboxes.tsv" TO "C:\QEnswitch\data"
COPY FILE "C:\QEnswitch\location.tsv" TO "C:\QEnswitch\data"
COPY FILE "C:\QEnswitch\ivrs.tsv" TO "C:\QEnswitch\data"
COPY FILE "C:\QEnswitch\huntgroups.tsv" TO "C:\QEnswitch\data"
COPY FILE "C:\QEnswitch\customers.tsv" TO "C:\QEnswitch\data"
COPY FILE "C:\QEnswitch\conferences.tsv" TO "C:\QEnswitch\data"

COPY FILE "C:\QEnswitch\*.dbf" TO "C:\QEnswitch\data"
COPY FILE "C:\QEnswitch\*.csv" TO "C:\QEnswitch\data"

IF !DIRECTORY("C:\QEnswitch\data\m"+ALLTRIM(per))
MD "C:\QEnswitch\data\m"+ALLTRIM(per)
COPY FILE "C:\QEnswitch\data\*.*" TO "C:\QEnswitch\data\m"+ALLTRIM(per)
DELETE FILE "C:\QEnswitch\data\*.*"
ELSE
DELETE FILE "C:\QEnswitch\data\m"+ALLTRIM(per)
COPY FILE "C:\QEnswitch\data\*.*" TO "C:\QEnswitch\data\m"+ALLTRIM(per)
DELETE FILE "C:\QEnswitch\data\*.*"
ENDIF
THISFORM.RELEASE
ENDIF


**ENDCODE**

Thanks,
FOXUP!
 
Yes, it would appear you're copying everything twice, first from QEnSwitch to QEnSwitch\Data and then from QEnSwitch\Data to QEnSwitch\Data\mxxx. Why not just skip the first copy and go directly from QEnSwitch to QEnSwitch\Data\mxxx?

Tamar
 
I knew it! LOL.


Thanks,
FOXUP!
 
Yes, you could make use of a variable for the final file destination right from the beginning. Not just "per", the full path cDest = "C:\QEnswitch\data\m"+ALLTRIM(per) and then check, whether the directory needs to be created. No need to ERASE or DELETE files in there, SET SAFETY OFF and you can overwrite files.

Bye, Olaf.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top