Struggling with FTP for windows ce: no files found

Hi Nick, thank you for trying to help me out.
When I go via telnet with the same user and pwd to the device this is the directory list of the root

Pocket CMD v 6.00
> dir

Directory of \

01/01/98 12:00p Mounted Volume
01/01/98 12:00p Storage Card
01/01/98 12:00p Storage Card2
01/19/21 09:10a Application Data
01/19/21 09:10a 23 Control Panel.lnk
01/19/21 09:10a My Documents
01/19/21 09:10a Program Files
01/19/21 09:10a Temp
01/19/21 09:10a Windows

Found 9 file(s). Total size 23 bytes.
1 Dir(s) 21819392 bytes free

When I go to the windows directory I get...

\windows> dir

Directory of \windows

01/22/21 09:42p 226915 FTPD.tmp
01/19/21 09:10a Fonts
01/19/21 09:10a Favorites
01/19/21 09:10a StartUp
01/19/21 09:10a Recent
01/19/21 09:10a Programs
01/19/21 09:10a Desktop
10/13/13 10:31a 55808 shell.exe
10/13/13 10:31a 70656 cmd.exe
11/04/13 02:15p 131584 connmc.exe
11/04/13 02:16p 17920 control.exe
11/04/13 02:17p 58880 repllog.exe
10/13/13 10:34a 8704 udp2tcp.exe
10/13/13 10:34a 51200 rapisrv.exe
11/04/13 02:17p 59392 wceload.exe
11/04/13 02:17p 15360 unload.exe
01/08/14 12:23p 140800 UtilsPkg.dll
01/08/14 12:23p 11264 Launcher.exe
12/31/13 02:03p 9728 SW_Watchdog.exe
12/31/13 02:03p 59392 Zipper.exe
12/31/13 02:03p 5632 TelnetMaintain.exe
11/04/13 02:13p 18012 ceconfig.h
12/02/06 03:17a 44192 msvcr80.dll
12/02/06 03:18a 100000 msvcr80d.dll
11/11/13 03:30p 27648 CP210xVCP.dll
06/10/13 02:36p 8704 dbg_setip.exe

Found 26 file(s). Total size 1121791 bytes.
1 Dir(s) 21819392 bytes free

With FileZilla from the same RPi and with the same user and pwd I see exactly the same.

I've written a small python script using ftplib. When I want to see the files in the windows directory I get this result. It's the same except for the hidden the files that are also included.

dev@raspberrypi:~/iq4wnd $ python Sync.py '192.168.1.1' 'user' 'pwd' 'Windows' '~/iq4wnd'
01-23-21 12:09 227722 FTPD.tmp
01-19-21 09:10 Fonts
01-19-21 09:10 Favorites
01-19-21 09:10 0 initobj.dat
01-19-21 09:10 StartUp
01-19-21 09:10 Recent
01-19-21 09:10 Programs
01-19-21 09:10 Desktop
10-13-13 10:42 199680 nk.exe
10-13-13 10:42 91648 kitl.dll
10-13-13 10:31 249856 kernel.dll
10-13-13 10:33 33792 kd.dll
10-13-13 10:33 5120 hd.dll
10-13-13 10:31 41472 osaxst0.dll
10-13-13 10:33 5632 osaxst1.dll
11-04-13 14:15 675328 coredll.dll
01-08-14 12:22 4608 oalioctl.dll
11-04-13 14:15 672256 k.coredll.dll
10-13-13 10:31 59392 fpcrt.dll
10-13-13 10:31 59392 k.fpcrt.dll
10-13-13 10:33 262144 filesys.dll
10-13-13 10:33 10752 romfsd.dll
11-04-13 14:16 667136 gwes.dll
10-13-13 10:32 209920 mgtt_o.dll
10-13-13 10:32 4096 device.dll
10-13-13 10:32 14336 udevice.exe
10-13-13 10:32 63488 devmgr.dll
10-13-13 10:32 7168 regenum.dll
10-13-13 10:32 14848 busenum.dll
10-13-13 10:32 48128 pm.dll
10-13-13 10:32 14848 servicesEnum.dll
10-13-13 10:32 28160 servicesd.exe
10-13-13 10:32 11264 services.exe
10-13-13 10:32 4096 servicesStart.exe
10-13-13 10:32 38400 notify.dll
10-13-13 10:33 101888 exfat.dll
10-13-13 10:33 11776 diskcache.dll
10-13-13 10:33 33792 cachefilt.dll
10-13-13 10:33 54784 fatutil.dll
10-13-13 10:33 54784 k.fatutil.dll
10-13-13 10:31 25088 relfsd.dll
10-13-13 10:31 55808 shell.exe
10-13-13 10:31 11264 shellcelog.dll
10-13-13 10:31 7168 toolhelp.dll
10-13-13 10:31 7168 k.toolhelp.dll
10-13-13 10:31 70656 cmd.exe
11-04-13 14:15 398336 commctrl.dll
10-13-13 10:31 88576 commdlg.dll
10-13-13 10:32 19456 softkb.dll
10-13-13 10:32 103424 largekb.dll
11-04-13 14:15 131584 connmc.exe
10-13-13 10:32 35840 rnaapp.exe
10-13-13 10:31 21504 regextdev.dll
10-13-13 10:31 130560 fsdmgr.dll
10-13-13 10:33 21504 mspart.dll
10-13-13 10:32 4608 netmui.dll
10-13-13 10:32 8704 ethman.dll
10-13-13 10:32 112640 ppp.dll
10-13-13 10:32 15872 asyncmac.dll
10-13-13 10:32 59392 pptp.dll
10-13-13 10:32 56832 l2tp.dll
10-13-13 10:32 22016 cxport.dll
10-13-13 10:32 55808 iphlpapi.dll
10-13-13 10:32 55808 k.iphlpapi.dll
10-13-13 10:31 39424 ws2.dll
10-13-13 10:31 39424 k.ws2.dll
10-13-13 10:32 9728 ws2instl.dll
10-13-13 10:32 9728 wspm.dll
10-13-13 10:32 9728 k.wspm.dll
10-13-13 10:32 11264 nspm.dll
10-13-13 10:32 11264 k.nspm.dll
10-13-13 10:32 53248 ws2k.dll
10-13-13 10:32 34304 ws2serv.dll
10-13-13 10:32 32768 ssllsp.dll
10-13-13 10:32 32768 k.ssllsp.dll
10-13-13 10:32 100864 schannel.dll
10-13-13 10:32 100864 k.schannel.dll
10-13-13 10:32 56832 credsvc.dll
10-13-13 10:32 65024 ipsec.dll
10-13-13 10:32 275456 ipsecsvc.dll
10-13-13 10:32 40448 ipseccfg.exe
10-13-13 10:32 109568 afd.dll
10-13-13 10:32 135168 ndis.dll
10-13-13 10:32 215552 netui.dll
10-13-13 10:32 22528 ndisuio.dll
10-13-13 10:32 7168 ndispwr.dll
10-13-13 10:32 7680 autoras.dll
10-13-13 10:32 76800 wzcsvc.dll
10-13-13 10:32 9216 wzcsapi.dll
10-13-13 10:32 33280 eapol.dll
10-13-13 10:32 20992 eap.dll
10-13-13 10:32 15872 eapchap.dll
10-13-13 10:32 24576 eaptls.dll
10-13-13 10:32 30208 dhcp.dll
10-13-13 10:33 9728 VMini.dll
10-13-13 10:32 335872 tcpstk.dll
10-13-13 10:32 75264 tapi.dll
10-13-13 10:32 45568 unimodem.dll
10-13-13 10:32 39936 netbios.dll
10-13-13 10:31 27648 lpcd.dll
10-13-13 10:31 7168 lpcrt.dll
10-13-13 10:32 14336 ping.exe
10-13-13 10:32 15360 ipconfig.exe
10-13-13 10:32 11264 ndisconfig.exe
10-13-13 10:32 15360 route.exe
10-13-13 10:32 21504 netstat.exe
10-13-13 10:32 12288 tracert.exe
10-13-13 10:32 17408 veim.dll
10-13-13 10:32 6656 dhcpsrv.dll
10-13-13 10:32 6656 k.dhcpsrv.dll
10-13-13 10:31 13824 cerdisp.exe
10-13-13 10:32 29184 serial.dll
10-13-13 10:42 71168 sdbus.dll
10-13-13 10:33 28160 sdhc.dll
10-13-13 10:33 18432 sdmemory.dll
10-13-13 10:33 25600 usbd.dll
10-13-13 10:33 19456 usbhid.dll
10-13-13 10:33 20480 usbmsc.dll
10-13-13 10:33 21504 usbdisk6.dll
10-13-13 10:33 25600 usb8023.dll
10-13-13 10:33 33280 rndismp.dll
10-13-13 10:33 36352 serialusbfn.dll
10-13-13 10:33 29184 hidparse.dll
10-13-13 10:32 7680 mmtimer.dll
10-13-13 10:32 7680 k.mmtimer.dll
10-13-13 10:32 5120 uiproxy.dll
10-13-13 10:31 12800 secur32.dll
10-13-13 10:31 12800 k.secur32.dll
10-13-13 10:31 44032 msasn1.dll
10-13-13 10:31 44032 k.msasn1.dll
10-13-13 10:32 279552 crypt32.dll
10-13-13 10:32 279552 k.crypt32.dll
10-13-13 10:31 6656 winsock.dll
10-13-13 10:31 6656 k.winsock.dll
10-13-13 10:32 6144 credprov.dll
10-13-13 10:33 480256 ole32.dll
10-13-13 10:33 198656 oleaut32.dll
10-13-13 10:33 99328 dcomssd.dll
10-13-13 10:33 9216 dllhost.exe
10-13-13 10:33 327168 rpcrt4.dll
11-04-13 14:16 136192 shlwapi.dll
11-04-13 14:16 12800 IECEExt.dll
11-04-13 14:16 748544 msxml3.dll
11-04-13 14:16 204800 shdocvw.dll
11-04-13 14:16 470528 wininet.dll
11-04-13 14:16 19456 jsproxy.dll
10-13-13 10:34 20992 telnetd.dll
10-13-13 10:34 51200 ftpd.dll
10-13-13 10:34 26112 timesvc.dll
11-04-13 14:16 41984 aygshell.dll
11-04-13 14:16 290304 ceshell.dll
11-04-13 14:16 280064 explorer.exe
11-04-13 14:16 11264 shcore.dll
10-13-13 10:34 58880 Dw.exe
10-13-13 10:34 59904 DwUi.dll
11-04-13 14:17 16384 DwCtlPnl.cpl
10-13-13 10:34 16384 DwXfer.dll
11-04-13 14:16 17920 control.exe
10-13-13 10:34 8192 ctlpnl.exe
11-04-13 14:16 213504 cplmain.cpl
11-04-13 14:16 56832 intlp.cpl
11-04-13 14:16 9728 connpnl.cpl
11-04-13 14:16 23552 stguip.cpl
11-04-13 14:17 58880 repllog.exe
10-13-13 10:34 8704 udp2tcp.exe
10-13-13 10:34 51200 rapisrv.exe
11-04-13 14:17 59392 wceload.exe
11-04-13 14:17 15360 unload.exe
11-04-13 14:17 12800 rra_stm.dll
10-13-13 10:34 4096 eventrst.exe
11-04-13 14:17 4096 system.cpl
11-04-13 14:17 31232 ossvcs.dll
11-04-13 14:17 43520 configmanager.dll
10-13-13 10:34 58880 connmgr.exe
11-04-13 14:17 16896 conncfg.dll
11-04-13 14:17 37888 connplan.dll
11-04-13 14:17 60416 cspras.dll
11-04-13 14:17 41984 cspnet.dll
11-04-13 14:17 36352 cspwwan.dll
11-04-13 14:17 24576 cspproxy.dll
11-04-13 14:17 196608 cspomadmconn.dll
11-04-13 14:17 1536 netres.dll
10-13-13 10:34 42496 AutoBind_lsp.dll
10-13-13 10:34 42496 k.AutoBind_lsp.dll
10-13-13 10:42 44544 ceddk.dll
10-13-13 10:42 44544 k.ceddk.dll
01-08-14 12:22 27136 omapbus.dll
01-08-14 12:22 7168 CustomDMA.dll
10-13-13 10:42 14848 omap_sdma.dll
10-13-13 10:42 30208 omap_sdhc.dll
01-08-14 12:22 11264 omap_gpio.dll
01-08-14 12:22 258560 omap_dss.dll
01-08-14 12:22 18432 omap_mcspi.dll
01-08-14 12:22 28672 omap_uart.dll
01-08-14 12:22 34816 omap_nand.dll
01-08-14 12:22 35328 smsc9118.dll
01-08-14 12:22 10752 omap_vrfb.dll
01-08-14 12:22 22528 omap_mcbsp.dll
01-08-14 12:22 66560 omap_musbfn.dll
01-08-14 12:22 74752 omap_musbhcd.dll
01-08-14 12:22 50688 omap_musbotg.dll
10-13-13 10:42 14848 tps659xx.dll
01-08-14 12:22 9728 tps659xx_gpio.dll
01-08-14 12:22 8704 tps659xx_rtc.dll
01-08-14 12:22 76800 omap_ehcihcd.dll
10-13-13 10:33 19968 kbdnop.dll
10-13-13 10:33 23040 kbdnopus.dll
01-08-14 12:22 9728 battdrvr.dll
10-10-13 13:56 5632 pwmdrv.dll
12-31-13 14:01 29184 CDCDriver.dll
01-08-14 12:23 140800 UtilsPkg.dll
12-31-13 09:01 112128 dsplinkk.dll
01-08-14 12:23 11264 Launcher.exe
12-31-13 14:03 9728 SW_Watchdog.exe
12-31-13 14:03 59392 Zipper.exe
12-31-13 14:03 5632 TelnetMaintain.exe
11-04-13 14:13 18012 ceconfig.h
01-08-14 12:23 127906 wince.nls
01-08-14 12:23 36864 boot.hv
01-08-14 12:23 245760 default.hv
01-08-14 12:23 40960 user.hv
01-08-14 12:23 9193 initdb.ini
09-07-06 01:00 134 close.2bp
09-07-06 01:00 134 ok.2bp
09-07-06 01:00 1030 stdsm.2bp
09-07-06 01:00 838 viewsm.2bp
09-07-06 01:00 2038 stdsm.bmp
09-07-06 01:00 1654 viewsm.bmp
09-07-06 01:00 176120 rsaenh.dll
09-07-06 01:00 116728 dssdh.dll
10-02-12 06:08 8211 sysroots.p7b
10-13-13 10:31 51712 ntlmssp.dll
10-13-13 10:31 87040 ntlmssp_svc.dll
09-07-06 01:00 135848 tahoma.ttf
09-07-06 01:00 69 appdata.ini
09-07-06 01:00 144 desktopdirectory.ini
09-07-06 01:00 69 favorites.ini
09-07-06 01:00 69 fonts.ini
09-07-06 01:00 69 mydocuments.ini
09-07-06 01:00 69 programfiles.ini
09-07-06 01:00 69 programs.ini
09-07-06 01:00 69 recent.ini
09-07-06 01:00 69 startup.ini
09-07-06 01:00 24 explore.lnk
09-07-06 01:00 13854 WindowsCE.bmp
09-07-06 01:00 19 cmd.lnk
09-07-06 01:00 23 control.lnk
10-03-13 14:07 739 copyrts.txt
10-03-13 14:07 3116 asterisk.wav
10-03-13 14:07 3388 close.wav
10-03-13 14:07 2970 critical.wav
10-03-13 14:07 2682 default.wav
10-03-13 14:07 3946 empty.wav
10-03-13 14:07 9204 exclam.wav
10-03-13 14:07 5656 infbeg.wav
10-03-13 14:07 1778 infend.wav
10-03-13 14:07 2088 infintr.wav
10-03-13 14:07 834 menupop.wav
10-03-13 14:07 360 menusel.wav
10-03-13 14:07 3388 openprog.wav
10-03-13 14:07 1836 question.wav
10-03-13 14:07 8508 startup.wav
10-03-13 14:07 2712 windmax.wav
10-03-13 14:07 2866 windmin.wav
10-03-13 14:07 3388 recstart.wav
10-03-13 14:07 3388 recend.wav
09-07-06 01:00 24 eventrst.lnk
10-13-13 10:43 6656 bsppnl.exe
01-08-14 12:22 7168 bsppnl.cpl
12-02-06 03:17 44192 msvcr80.dll
12-02-06 03:18 100000 msvcr80d.dll
01-08-14 12:22 6144 sht71drvr.dll
10-10-13 13:56 6144 HMC6343drvr.dll
01-08-14 12:22 6656 bmp085drvr.dll
01-08-14 12:22 7168 ADT7411drvr.dll
01-08-14 12:22 5632 dacdrv.dll
01-08-14 12:22 10752 m25p32.dll
10-10-13 13:56 4096 wdgdrv.dll
11-11-13 15:30 27648 CP210xVCP.dll
04-30-13 08:00 31232 osu.dll
06-10-13 14:36 8704 dbg_setip.exe

That is interesting. The thing I note us that it likes it's paths separated by \

So does this do anything?

rclone lsf pentalum:\ -vv --dump bodies

Rclone will be using / to construct deeper paths which may not work.

dev@raspberrypi:~/iq4wnd $ rclone lsf pentalum:\ -vv --dump bodies
2021/01/23 13:36:47 ERROR : : error listing: directory not found
2021/01/23 13:36:47 Failed to lsf with 2 errors: last error was: error in ListJSON: directory not found

Sorry, I think you'll want this since you are using this from unix aren't you.

rclone lsf pentalum:'\' -vv --dump bodies

dev@raspberrypi:~/iq4wnd $ rclone lsf pentalum:'' -vv --dump bodies
2021/01/23 14:21:52 DEBUG : rclone: Version "v1.53.3" starting with parameters ["rclone" "lsf" "pentalum:\" "-vv" "--dump" "bodies"]
2021/01/23 14:21:52 DEBUG : Using config file from "/home/dev/.config/rclone/rclone.conf"
2021/01/23 14:21:52 DEBUG : Creating backend with remote "pentalum:\"
2021/01/23 14:21:52 DEBUG : ftp://192.168.1.1:21/: Connecting to FTP server
2021/01/23 14:21:52 DEBUG : FTP Rx: "220 Service ready for new user."
2021/01/23 14:21:52 DEBUG : FTP Tx: "FEAT"
2021/01/23 14:21:52 DEBUG : FTP Rx: "500 Syntax error, command unrecognized."
2021/01/23 14:21:52 DEBUG : FTP Tx: "USER pentalum"
2021/01/23 14:21:52 DEBUG : FTP Rx: "331 User name okay, need password."
2021/01/23 14:21:52 DEBUG : FTP Tx: PASS *****
2021/01/23 14:21:52 DEBUG : FTP Rx: "230 User logged in, proceed."
2021/01/23 14:21:52 DEBUG : FTP Tx: "TYPE I"
2021/01/23 14:21:52 DEBUG : FTP Rx: "200 Command okay."
2021/01/23 14:21:52 DEBUG : FTP Tx: "PASV"
2021/01/23 14:21:52 DEBUG : FTP Rx: "227 Entering Passive Mode (192,168,1,1,196,188)."
2021/01/23 14:21:52 DEBUG : FTP Tx: "LIST ."
2021/01/23 14:21:52 DEBUG : FTP Rx: "125 Data connection already open; transfer starting."
2021/01/23 14:21:52 DEBUG : FTP Rx: "226 Closing data connection. "
2021/01/23 14:21:52 DEBUG : FTP Tx: "PASV"
2021/01/23 14:21:52 DEBUG : FTP Rx: "227 Entering Passive Mode (192,168,1,1,196,189)."
2021/01/23 14:21:52 DEBUG : FTP Tx: "LIST \"
2021/01/23 14:21:52 DEBUG : FTP Rx: "125 Data connection already open; transfer starting."
2021/01/23 14:21:52 DEBUG : FTP Rx: "226 Closing data connection. "
2021/01/23 14:21:52 DEBUG : FTP Tx: "PASV"
2021/01/23 14:21:52 DEBUG : FTP Rx: "227 Entering Passive Mode (192,168,1,1,196,190)."
2021/01/23 14:21:52 DEBUG : FTP Tx: "LIST ."
2021/01/23 14:21:52 DEBUG : FTP Rx: "125 Data connection already open; transfer starting."
2021/01/23 14:21:52 DEBUG : FTP Rx: "226 Closing data connection. "
2021/01/23 14:21:52 ERROR : : error listing: directory not found
2021/01/23 14:21:52 DEBUG : 2 go routines active
2021/01/23 14:21:52 Failed to lsf with 2 errors: last error was: error in ListJSON: directory not found

:confused:

I don't know what is happening, I expected that to work.

Would it be possible to get access to a device like this easily?

If you're interested I can share a (rather ugly;-)) python script that does the job. I had to stick to basic ftplib commands. Any package I tried to use based on mlsd and nlist failed. The Windows CE on the device and probably also the ftp server are quite old...

That would be interesting...

That probably explains the problem then!

This is the dump of a dirty scrip I will clean up later;-)
As you can see I only rely on the very ftp basics.

#!/usr/bin/python3
# Use absolute path for source starting with /

import sys
import ftplib
import logging
import os
logging.basicConfig(level=logging.DEBUG)

def FTPList(ftp, source, filelist):
    logging.info('Reading ' + source)
    ftp.cwd(source)
    files = []
    ftp.dir(lambda f: files.append(f) if (f is not None) else Pass)
    for f in files:
        dt = f[:15]
        type = f[16:35].strip()
        name = f[36:].strip()
        if type == '<DIR>':
            FTPList(ftp, source + '/' + name, filelist)            
        else:
            filelist.append(source + '/' + name)
    logging.info(str(len(filelist)) + ' files found')
    return filelist

def FTPCopyToLocal(FTPserver, user, password, source, target):
    ftp = ftplib.FTP(FTPserver)       
    try:
        ftp.login(user=user,passwd=password)
        # force UTF-8 encoding
        ftp.encoding = "utf-8"
        filelist = []
        FTPList(ftp=ftp, source=source, filelist=filelist)
        for f in filelist:
            if os.path.exists(target + f) == False:
                if not os.path.exists(os.path.dirname(target + f)):
                    try:
                        original_umask = os.umask(0)
                        os.makedirs(os.path.dirname(target + f), exist_ok=True)
                    finally:
                        os.umask(original_umask)
                fhandle = open(target + f, 'wb')
                logging.info('Getting ' + f)
                try:
                    ftp.retrbinary('RETR ' + f, fhandle.write)
                except ftplib.error_perm:
                    logging.error('Permission error for ' + f)
                fhandle.close()
            elif os.path.exists(target + f) == True:
                logging.info('File ' + str(target + f) + ' already exists. Skipping download')
                
    except ftplib.all_errors as e:
        logging.error('FTP error:', e)
    ftp.quit

def main():
    try:
        FTPCopyToLocal(FTPserver=sys.argv[1],
                       user=sys.argv[2],
                       password=sys.argv[3],
                       source=sys.argv[4],
                       target=sys.argv[5])
        return True
    except Exception as e:
        logging.error(e)
        return False

if __name__ == "__main__":
    main()

Thank you for that.

I think I'm going to stop chasing down this rabbit hole for the moment - I could probably fix this, but I'd need access to the FTP server :slight_smile:

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.