Copy a complete Folder via RAPI

G

Guest

Hi,

I want to copy a complete folder from the Pocket PC to PC.
The connection between the Pocket PC and the stand-alone Pc is via RAS.

Up to now, I use to try the system.io.file.copy(x,y) function. For a only FILE is this alright, but if i want the complete Files of the folder.

For example:

Folder:
my Documents
Files init: ikoiko.txt, kali.txt, ....

I want to do: file.copy("\my documents\*.*", "\\demo\*.*")
Which function can do that ?

My Codelanguage are vb.net,
PPC: Pocket Pc 2003 mobile Edt,

Thanky alto and maybe anybody can help me.

regards

André
 
P

Peter Foot [MVP]

You can use System.IO.Directory.GetFiles to return an array of filenames in
a specific folder. Then for each of these perform a file copy.

Peter

--
Peter Foot
Windows Embedded MVP
OpenNETCF.org Senior Advisor
www.inthehand.com | www.opennetcf.org

Andre said:
Hi,

I want to copy a complete folder from the Pocket PC to PC.
The connection between the Pocket PC and the stand-alone Pc is via RAS.

Up to now, I use to try the system.io.file.copy(x,y) function. For a only
FILE is this alright, but if i want the complete Files of the folder.
 
A

Alex Feinman [MVP]

Since you don't tell on which line the code fails and what is the error
message, I can only guess that the problem is in this:
dest = "\\pc010\mda\" + fi.FullName()

fi.FullName() returns a path like \Windows\tada.wav, hence you can't use it
in this context. Use instead:
dest = "\\pc010\mda\" + fi.Name

Note that this is insufficient if you have nested subdirectories - you will
need to rewrite your code to handle that recursively
Also, not every file can be copied off the device - files in ROM generally
cannot be copied
 
G

Guest

Hi Alex

thanks for your fast request

The FailureMessage calls:
'System.NullReferenceException'

In Line
For Each fi In FileFolder.GetFiles(

Complete New Code

Dim fi As System.IO.FileInf
Dim FileFolder As System.IO.DirectoryInf

FileFolder.GetDirectories("pictures"

Dim dest As Strin

For Each fi In FileFolder.GetFiles(
dest= "\\pc010\mda\" + fi.Nam
File.Copy(fi.FullName(), dest, True
Nex

maybe you Alex or another can help me
Thank you very much at advance

with compliment

AndrÃ
 
G

Guest

Hi @all,

now, already is fine.
I 've found the mistake.

Dim FileFolder As DirectoryInfo = New DirectoryInfo("\pictures")

fails. The constructor could not found the Order.

I 'm very happy.

Mostly thanks for your helps.

André
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top