Copy File Name

Natter
Posts: 1244
Joined: Mon May 14, 2007 9:49 am

Re: Copy File Name

Post by Natter »

dim:=directory(MyFolder+"\*.*")
User avatar
karinha
Posts: 7951
Joined: Tue Dec 20, 2005 7:36 pm
Location: São Paulo - Brasil
Been thanked: 3 times
Contact:

Re: Copy File Name

Post by karinha »

João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
Natter
Posts: 1244
Joined: Mon May 14, 2007 9:49 am

Re: Copy File Name

Post by Natter »

I did not make an empty text file .
https://cloud.mail.ru/public/jKRA/mDdPAAgoS
The header of this file consists of 3 characters D090 D090 CC86.
D0 is Cyrillic UTF-8. After reading this file through directory() I will get AA?.txt because the FW not recognize the CC86 symbol. This symbol must be deleted. I can edit the file headers in Explorer or TC, but there are a lot of files with the CC86 symbol in my name on the network (I haven't figured out where yet), You can rename such files from FW, apparently, through the bat file

chcp 1251
cmd ren C:\file1*.pdf file2.pdf

or bat file Powershell
User avatar
Otto
Posts: 6414
Joined: Fri Oct 07, 2005 7:07 pm
Has thanked: 30 times
Been thanked: 2 times
Contact:

Re: Copy File Name

Post by Otto »

Hello Natter,
I didn't think I would deal with this problem so quickly myself.
Are you using xHarbur or Harbour.
With Chinese characters my test program compiled with Harbor works fine. But not with xHarbour.



Best regards,
Otto

Code: Select all | Expand


#include "fivewin.ch"
     #include "ini.ch"
     
     #include "adodef.ch"
     #include "ord.ch"
     #include "xbrowse.ch"
               
     function Main()
     
      local I, cVData
      local cReturn := ""
           
      HB_CDPSELECT( "UTF8" )
      FW_SetUnicode( .T. )
           
      aDir := directory( "C:\test\source\C*.*","DHS")
      xbrowse(aDir )
           
      cVData := aDir[1,1]
     
      for I := 1 to len(cVData)
        cReturn += (str(I) + "-" + cVData + CRLF + substr( cVData, I, 1 ) + " # "+ str( ASC ( substr( cVData, I, 1 ) ) ))  + CRLF
      next
           
      ? cReturn
     
      ? memoread( "C:\test\source\" + cVData ) 
     
     
     
     
    return nil
********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org
https://www.facebook.com/groups/modharbour.club
********************************************************************
User avatar
Otto
Posts: 6414
Joined: Fri Oct 07, 2005 7:07 pm
Has thanked: 30 times
Been thanked: 2 times
Contact:

Re: Copy File Name

Post by Otto »

Dear Antonio,
with HARBOUR this is working fine. It is not working for me with xHarbour. But I switched the project to HARBOUR.

Best regards,
Otto
HARBOURINO now supports
HB_CDPSELECT( "UTF8" )
FW_SetUnicode( .T. )

Image

Image
********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org
https://www.facebook.com/groups/modharbour.club
********************************************************************
Natter
Posts: 1244
Joined: Mon May 14, 2007 9:49 am

Re: Copy File Name

Post by Natter »

Otto, I built your program under Harbor and tried to read the file (not empty). I get empty :cry:
User avatar
cnavarro
Posts: 6558
Joined: Wed Feb 15, 2012 8:25 pm
Location: España
Been thanked: 3 times

Re: Copy File Name

Post by cnavarro »

Look my screen ( file list on the left of the screen ) and tell me better your problem
Image
Cristobal Navarro
Hay dos tipos de personas: las que te hacen perder el tiempo y las que te hacen perder la noción del tiempo
El secreto de la felicidad no está en hacer lo que te gusta, sino en que te guste lo que haces
Post Reply