Re: system() and copy in DOS

new topic     » goto parent     » topic index » view thread      » older message » newer message

Me wrote:

> Rob wrote:
>
>> Travis Beaty wrote:
>>> In Linux, this works fine.  However, in Windows XP I'm having a bit of a
>>> problem because the filename being copied is truncated to eight
>>> characters.  Apparently it is a problem with long filenames, which as I
>>> recall Euphoria has had some issues with in the past.  I don't think
>>> that it is Euphoria though, because of the fact that Euphoria isn't
>>> actually doing the copying, it is simply calling the DOS copy command
>>> via a call to system().
>>
>> When you run the system() command in ex.exe,
>> XP runs an old version of DOS that
>> only supports 8.3 filenames.
>
>
> In that situation, *long* filenames can be processed by using my library
> "Lfn.zip" from the user contributions page.
> Instead of
>    system("del "  & bkname, 2)
>    system("copy " & name & " " & bkname, 2)
>
> one has then to write
>    system("del "  & short_name(bkname), 2)
>    system("copy " & short_name(name) & " " & short_name(bkname), 2)
                                               ^^^^^^^^^^^^^^^^^^
Oops. If forgot to mention, that this may not lead to the desired
result. 'short_name(file)' only works as expected, if 'file' already
exists. To achieve this, don't delete it before copying. If the
destination file does *not* already exist, just let your program first
create a small destination file with the desired long 'bkname'.

BTW: I personally prefer to let my program copy the data itself, using a
small while() loop. I don't know, which method is faster.

>> If you run system() using exw.exe
>> (or exwc.exe - see euphoria\bin\makecon.exw)
>> you'll get full support for long filenames.

Best regards,
   Juergen

-- 
The difference between men and boys
is the price of the toys.

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu