Solved

copying a file over the network

Posted on 2000-02-24
7
177 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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
This Micro Tutorial will give you a basic overview how to record your screen with Microsoft Expression Encoder. This program is still free and open for the public to download. This will be demonstrated using Microsoft Expression Encoder 4.
Both in life and business – not all partnerships are created equal. As the demand for cloud services increases, so do the number of self-proclaimed cloud partners. Asking the right questions up front in the partnership, will enable both parties …

863 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

22 Experts available now in Live!

Get 1:1 Help Now