Solved

copying a file over the network

Posted on 2000-02-24
7
175 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
Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

 
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

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
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…
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

707 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now