Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Wildcard Copies
Message
De
30/03/1998 16:59:33
 
 
À
30/03/1998 16:52:32
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Titre:
Divers
Thread ID:
00088079
Message ID:
00088237
Vues:
46
>>>>>>I'm trying to copy the contents of four directories
>>>>>>from one machine to another programatically. The copies
>>>>>>work fine in windows 95 using a dos bat file with the
>>>>>>format: copy C:\Mydirectory\*.* S:\Mydirectory where S
>>>>>>is a mapped drive. I would like to do this in VFP3 since
>>>>>>I first update 4 files one each in the 4 directories I
>>>>>>am copying and the update takes place in VFP3 and after
>>>>>>the copy calls a VFP3 program which turns the originating
>>>>>>machine off. The proble is that the DOS batch file
>>>>>>proceeds to begin the copies without waiting for the
>>>>>>VFP3 program to finish updating the files. I want to
>>>>>>use a wildcard copy because the number of files is so
>>>>>>large and I don't want to have to update this program
>>>>>>if the system expands to include new files. Thanks
>>>>>>Derek
>>>>>
>>>>>Derek,
>>>>>You still on this beast??? In addition to what Edward said, I found that ADIR() caused memory problems if the file list increased. What I do personally is to call DIR LIKE *.* TO , then use fopen(), and a do while ... loop to fgets the file list. This will pick up a list of files within the string (try dir like manually to see what comes out). Then you loop through each string picking out the file names (use trim and rat(' ') repeatedly to pull out the filenames). You can then do a COPY FILE for each file name you find. ADIR() with a 'D' clause will get any subdirectories. Be aware that you could get in a bit of a tangle if there are going to be many subdirectories - this is a nightmare (I've had some!!!). Regards,
>>>>
>>>>Nigel and Ed,
>>>>I just got Nigel's reply two minutes ago so I haven't done
>>>> anything with it yet
>>>>but will. However I used Ed's response and "Using Visual FoxPro
>>>>3 for Windows to cobble together this code which isn't working
>>>>yet. The directory I picked is judt one with a subdirectory
>>>>which is not too big. Any suggestions beyond what you've
>>>>already told me. Thanks Derek
>>>
>>>local cFilename,cDestfilename,nLoop
>>>=adir(aFiles,"c:\yoursourcefolder\*.*")
>>>for nLoop=1 to alen(aFiles,1)

I am losing it.  I forgot to send the code in question with 
my question.  As I said it parses but say there is an invalid
path or file name.  The source directory exits and has files
and the destination exists but is empty.  Any suggestions.
Gratefully Derek
local cFilename,cDestfilename,nLoop
 =adir(aFiles,"c:\Tvtuner\*.*")
 for nLoop=1 to alen(aFiles,1)
  cFilename="c:\Tvtuner\"+aFiles[nLoop,1]
  cDestfilename="D:\Tvtuner\"+cFilename
  COPY FILE (cFilename) to (cDestfilename)
 endfor
 >
>>> cFilename=c:\yoursourcefolder\+aFiles[nLoop,1]
>>> cDestfilename="c:\yourdestinationfolder\"+cFilename
>>> COPY FILE (cFilename) to (cDestfilename)
>>>endfor
>>>
>>
>>
>>I know I must be close. The code below which is your code with
>>the local information substituted yields "invalid path or file
>>name" which means everything else parses. The directory is
>>on the source and has files. The destination is on d but is
>>empty. Does anything jump off the page at you? Best Derek
>
>Derek, this code contained typo, and I already posted correction.
>>>
>>>local cFilename,cDestfilename,nLoop
>>>=adir(aFiles,"c:\yoursourcefolder\*.*")
>>>for nLoop=1 to alen(aFiles,1)
>>> cFilename=c:\yoursourcefolder\+aFiles[nLoop,1]
>>> cDestfilename="c:\yourdestinationfolder\"+aFiles[nLoop,1]
>>> COPY FILE (cFilename) to (cDestfilename)
>>>endfor
>>>
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform