dbTalk Databases Forums  

/** Create folder and copy files **/

comp.databases.xbase.fox comp.databases.xbase.fox


Discuss /** Create folder and copy files **/ in the comp.databases.xbase.fox forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Luc
 
Posts: n/a

Default /** Create folder and copy files **/ - 07-16-2003 , 03:54 PM






Hi, first a piece of code:

&& format a date AAMMDD
rDate = dtoc(DATE())
rDate = substr(rDate, 3, 2)+ substr(rDate, 6, 2)+substr(rDate, 9, 2)

&& create a new folder with the format date
MKDIR c:\temp\&rDate

&& copy a file in the new folder
COPY FILE ("c:\temp\database.dbf") to ("c:\temp\"+rDate+"\database.dbf")


Second, here is the problem:

1- a folder with the correct name is create (WORKING)
2- the file is not copied in the new folder (NOT WORKING)


I don't understand why the file does not want to be copied (and no error).

If someone have a idea . . . thanks in advance!

Reply With Quote
  #2  
Old   
John
 
Posts: n/a

Default Re: /** Create folder and copy files **/ - 07-17-2003 , 09:03 PM






lbrassard (AT) newlook (DOT) ca (Luc) wrote in message news:<19f162ff.0307161254.559c5027 (AT) posting (DOT) google.com>...
Quote:
Hi, first a piece of code:

&& format a date AAMMDD
rDate = dtoc(DATE())
rDate = substr(rDate, 3, 2)+ substr(rDate, 6, 2)+substr(rDate, 9, 2)

&& create a new folder with the format date
MKDIR c:\temp\&rDate

&& copy a file in the new folder
COPY FILE ("c:\temp\database.dbf") to ("c:\temp\"+rDate+"\database.dbf")


Second, here is the problem:

1- a folder with the correct name is create (WORKING)
2- the file is not copied in the new folder (NOT WORKING)


I don't understand why the file does not want to be copied (and no error).

If someone have a idea . . . thanks in advance!
After the directory is created properly, try:

cFilename = "c:\temp\"+rDate+"\database.dbf"
COPY FILE c:\temp\database.dbf TO &cFilename

Obviously, c:\temp\database.dbf cannot be open when you try to copy it

John


Reply With Quote
  #3  
Old   
Stefan Wuebbe
 
Posts: n/a

Default Re: /** Create folder and copy files **/ - 07-21-2003 , 05:20 AM



Hi,

Quote:
1- a folder with the correct name is create (WORKING)
2- the file is not copied in the new folder (NOT WORKING)
I don't understand why the file does not want to be copied (and no error).
Your code works for me, so just a guess: maybe the file
is in use and you have an active error handler eating the
native Vfp error 3 message?


(In general personally I would not use DTOC() but
DTOS(DATE()) && or SUBSTR( DTOS(DATE()),3 )
to be independent of things like Set Date, Century, Sysformats
etc..
Also in general, better use (name expressions) instead of
&macro substitutions if possible.
Quote:
MKDIR c:\temp\&rDate
MKDIR ("c:\temp\" + rDate)

Would GETENV('temp') help to avoid the hardcoded full-
path?)


-Stefan

"Luc" <lbrassard (AT) newlook (DOT) ca> schrieb
Quote:
Hi, first a piece of code:

&& format a date AAMMDD
rDate = dtoc(DATE())
rDate = substr(rDate, 3, 2)+ substr(rDate, 6, 2)+substr(rDate, 9, 2)

&& create a new folder with the format date
MKDIR c:\temp\&rDate

&& copy a file in the new folder
COPY FILE ("c:\temp\database.dbf") to ("c:\temp\"+rDate+"\database.dbf")


Second, here is the problem:

1- a folder with the correct name is create (WORKING)
2- the file is not copied in the new folder (NOT WORKING)


I don't understand why the file does not want to be copied (and no error).

If someone have a idea . . . thanks in advance!


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.