Natter wrote:The file in question has a header in UTF 8. It contains characters from another code table.
In this case, DIRECTORY() will show the file name with the characters "?" in places of characters from another code table.
Therefore, I cannot copy or change the name of this file using FW tools.
#include "Fivewin.ch"
#include "Directry.ch"
FUNCTION MAIN()
LOCAL aDir := DIRECTORY( "25_10_2024_*.docx" )
LOCAL i
FOR i = 1 TO LEN( aDir )
? WAITRUN( "CMD /C COPY /b " + aDir[ i, F_NAME ] + " Test" + LTRIM( STR( i ) ) + ".docx", 0 )
NEXT
RETURN NIL
function CopyX()
WaitRun( "xcopy " + cSrcDir + "my*file.txt " + cDstDir + " /Y" )
? "Copied"
return nil
function CopyHB()
HB_CDPSELECT( "UTF8" )
XBROWSER( aFiles := DIRECTORY( cSrcDir + "My*File.txt" ) )
AEval( aFiles, { |a| FileCopy( cSrcDir + a[1], cDstDir + a[1] ) } )
? "copied"
return nil
function NatCreate()
local aFiles := { "Own", Chr(196)+Chr(197)+Chr(198), Chr(196)+Chr(197)+Chr(198), ;
CHR(208)+CHR(221)+CHR(222), HEXTOSTR( "E0B0AEE0B0A8E0B0B5" ) }
local cdp := { "DEWIN", "DEWIN", "RU1251", "TRWIN", "UTF8" }
FW_setunicode( .t. )
WinExec( "del c:\natfiles\src\*.*" )
AEval( aFiles, { |c,i| aFiles[ i ] := "My" + c + "File.txt" } )
xbrowser afiles
AEVAL( aFiles, <|c,i|
HB_CDPSELECT( cdp[ i ] )
HB_MEMOWRIT( "c:\natfiles\src\" + c, c )
return nil
> )
return nil
function NatRead()
local cSrcDir := "c:\natfiles\src\"
local cDstDir := "c:\natfiles\dst\"
local aFiles
local cmd
FW_SetUnicode( .t. )
WinExec( "CMD /K DIR c:\natfiles\src\*.*" )
FW_SetUnicode( .t. )
HB_CDPSELECT( "UTF8" )
XBROWSER ( aFiles := DIRECTORY( cSrcDir + "My???File.txt" ) ) ;
COLUMNS 1, ;
{ |x,o| If( IsUtf8( o:oBrw:aRow[ 1 ] ), "UTF8", "...." ) }, ;
{ |x,o| Len( o:oBrw:aRow[ 1 ] ) }, ;
{|x,o| StrToHex( o:oBrw:aRow[ 1 ] ) } ;
TITLE BeforAtNum( " ", Version(), 1 )
#ifndef __XHARBOUR__
if MsgNoYes( "Copy Files (Y/N)?" )
AEval( aFiles, { |a| FileCopy( cSrcDir + a[1], cDstDir + a[1] ) } )
? "Copied"
endif
#endif
return nil
Return to FiveWin for Harbour/xHarbour
Users browsing this forum: Google [Bot] and 23 guests