Solved

copying a file over the network

Posted on 2000-02-24
7
178 Views
Last Modified: 2010-04-04
Hi

I have an ap which needs to copy files from a cd rom to a folder on my local hard drive.  This works OK on my home PC, but at work on the network I get the error message "Directory does not exist".

I have done some experimenting to isolate the problem, and I have discovered that the error relates to a path with a space in the name - ie. w:\mar31_97\form files.  When I leave the "form files" bit out of it there is no error message.  Of course I tried formfi~1, but I still get the same error. I also tried to use a UNC path, but that failed too.

We are using NT SERVER 4, so it should be able to recognise long file names, shouldn't it?  The copy routine I am using is from fmxutils.pas, and I am using D4 Standard.

Any help would be much appreciated

Regards

John
0
Comment
Question by:jdthedj
7 Comments
 
LVL 13

Expert Comment

by:Epsylon
ID: 2555719
put the entire path between "
0
 
LVL 13

Expert Comment

by:Epsylon
ID: 2555720
Like "w:\mar31_97\form files"
0
 
LVL 3

Author Comment

by:jdthedj
ID: 2555728
Thanks for the reply Epsylon.  I have tried it, but that will not work either.

John
0
Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

 
LVL 1

Accepted Solution

by:
Fatman121898 earned 100 total points
ID: 2556997
Hi John,

I tried to copy files from one folder to another (I mean longname files) on NT4 SERVER, and it was allright.

The code I used is cutted from my old app:

 function CopyFiles(const FileSpec, NewPath:String; Move: Boolean): Boolean;
{Copies file or files}
  var
    FSearchRec: TSearchRec;
    Found: Integer;
    SomeFound, AllCopied, CurrentCopied: Boolean;
    AllErased, CurrentErased: Boolean;
  begin
    AllCopied:=True;
    AllErased:=True;
    Found:= FindFirst(PChar(FileSpec), faArchive, FSearchRec);
    SomeFound:=(Found=0);
     while Found = 0 do
       begin
         CurrentCopied:=CopyFile(PChar(ExtractFilePath(FileSpec)+FSearchRec.Name),
                            PChar(NewPath+FSearchRec.Name), False);
         AllCopied:=AllCopied AND CurrentCopied;
         if Move AND CurrentCopied
           then //delete file
             begin
               CurrentErased:=(DeleteFile(PChar(ExtractFilePath(FileSpec)+FSearchRec.Name)));
               AllErased:=AllErased AND CurrentErased;
             end;
         Found:=FindNext(FSearchRec);
       end;
    SysUtils.FindClose(FSearchRec);
    Result:=SomeFound AND AllCopied AND AllErased;
  end;

Hope helps.
Jo.
0
 
LVL 20

Expert Comment

by:Madshi
ID: 2557118
I don't know those fmxutils, but with the standard CopyFile API you'll have no problems to do what you want to do (we're doing this all day).

Regards, Madshi.
0
 
LVL 1

Expert Comment

by:Phoenix_s
ID: 2559137
fmxutils works GREAT with delphi 3

fmxutils and delphi 4.  yecchh

been there... hated it.

the standard copyfile does seem to be the one to use.
0
 
LVL 3

Author Comment

by:jdthedj
ID: 2559883
Hi Jo, Madshi and Phoenix S - thanks for the replies.  

I have tried Jo's code and it works, so I will accept that as an answer.
0

Featured Post

ScreenConnect 6.0 Free Trial

Want empowering updates? You're in the right place! Discover new features in ScreenConnect 6.0, based on partner feedback, to keep you business operating smoothly and optimally (the way it should be). Explore all of the extras and enhancements for yourself!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
how to center only a line in richedit? 4 58
Delphi selector screen 2 80
Firemonkey DbLookupComboBox equivalent ? 2 49
Delphi problems to abort a printjob 9 21
Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
This Micro Tutorial will teach you how to censor certain areas of your screen. The example in this video will show a little boy's face being blurred. This will be demonstrated using Adobe Premiere Pro CS6.
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …

821 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question