hi all, new here and doing my best with a bit of FTP code but have got stuck so would appreciate some help, thanks in advance...

I have the following bit of code

'------------------------------------------
    'Command format :       [PUTFILES] = <local directory> ; <remote directory>
    'Example :              [PUTFILES] = C:\TEMP\ ; /test/
    'Puts files from the local drive on to the remote server
    'PUT over rights the remote files
    If InStr(1, LCase(line), "[putfiles]") > 0 Then
        pos = InStr(1, line, "=")
        strData = Trim(Mid(line, pos + 1))
        
        strFiles = Split(strData, ";")
        strLocal = Trim(strFiles(0))
        strRemote = Trim(strFiles(1))
        Call PutFiles(strLocal, strRemote)
        logfile.AddToLogFile ("Put files " & vbCrLf)
        Exit Sub
    End If

This is called by this line: [PUTFILES] = "c:\program files\radio show\audio\" ; /radioshow/www/user/audio/ And this works BUT... the source filename loses the first 2 characters of its name and i cant figure out why. For example, if I put the file audio.mp3 in the audio folder in the source directory, it gets uploaded into the correct remote folder, but ends up as dio.mp3 ( i have tried other files and they all lose the first 2 charachters...)

I would appreciate any help on this, its doing my head in!!

Thanks again for your time in advance.

Recommended Answers

All 3 Replies

stick a msgbox right after strData = trim (msgbox strData) then do one after strlocal = trim, and one strRemote. Make sure that it's not your code that is truncating the file. If needed, find the PutFiles sub, and throw some messageboxes in there too. Basically, trace your file name from the moment the program gets it, to the point where it gets sent to the wire. Then you'll know if it's your code, or say, the server.

hi, many thanks for your advice, i appreciate your time.

I have since discovered that the problem may lie with the source spaces, as this works:

[PUTFILES] =  c:\programfiles\radio\audio\ ; /radioshowreel/www/gavinwatson/audio/

i.e. with no spaces in the source fodler structure, the destination file ends up ok, but with spaces (as per previous example) it loses the first two characters...

So... I have located the problem, but what to do about it??

thanks again for your help.

You can try using /'s. A lot of compilers and what not will read / in windows machines. You could also try quoting the parameter on the command line, for instance: yourprogram.exe "c:\program files\radio\audio"

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.