Home > Archive > Programming with dBASE > January 2006 > Copy Directory









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Copy Directory
Dan Barbaria

2006-01-19, 8:23 pm

I files stored in directories that are named in the following format: 28472
south.con.

The original 28472 south.con directory is on a network drive K: and
contains several files. After processing the files, I want to copy the
directory and all the files to another network dirve G: In my program I use
the following line to do this task:

nextline = [run copy /y "] + rtrim(cDirName) +[" "]+cNewDirectory+["]
&nextline

The result is that only some of the files are in the copied directory.

I tried running the command directly in the dos command window with the same
result. I looked at the properties of the files and they all have archived
marked.

Can anyone explain this to me and how I can get all the files copied?

Thanks

Dan B.


Dan Barbaria

2006-01-20, 8:23 pm


"Dan Barbaria" <daniel.barbaria at ops.org> wrote in message
news:xqVq7MTHGHA.1080@news-server...
>I files stored in directories that are named in the following format: 28472
>south.con.
>

I cannot understand the behavior I mentioned in my previous post but I did
find a fix with the code below:

#define ARRAY_DIR_NAME 1 // Manifest constants for columns returned by
dir( )
#define ARRAY_DIR_SIZE 2
#define ARRAY_DIR_DATE 3
#define ARRAY_DIR_TIME 4
#define ARRAY_DIR_ATTR 5
CopyDir(dirName,cNew
Directory,f)

Function CopyDir(dirName,cNew
Directory,f)
aFiles = new Array() // Array will be resized as needed
nextline = [nFiles = aFiles.dir("]+dirName+[\*.*","HS")]
&nextline
for nFile = 1 to nFiles
x =dirName+"\"+ aFiles[ nFile, ARRAY_DIR_NAME ]
y=cNewDirectory +"\"+ aFiles[ nFile, ARRAY_DIR_NAME ]
nextline =[new File().copy("]+x+[","]+y+[")]
&nextline
f.text3.text = "Copying "+x
endfor
f.text3.text = dirName + " Copied"
x = null
y= null
nextline = null
return


Sponsored Links





Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive | Programming forum archive

Copyright 2008 droptable.com