Results 1 to 6 of 6
  1. #1
    New Lounger
    Join Date
    Jan 2004
    Posts
    21
    Thanks
    0
    Thanked 0 Times in 0 Posts

    FTP to Unix (2000)

    HI All,

    Here's my problem: I am trying to FTP some files up to a Unix server. I have the code and it works correctly, provided a file with the same name does not already exist in that location on the Unix server. So what I need to do is check if the file exists on the Unix server and delete it if it does exist, before copying the new file up there.

    Does anyone have any ideas how I could do this?

    Thanks
    JB

  2. #2
    WS Lounge VIP sdckapr's Avatar
    Join Date
    Jul 2002
    Location
    Pittsburgh, Pennsylvania, USA
    Posts
    11,225
    Thanks
    14
    Thanked 342 Times in 335 Posts

    Re: FTP to Unix (2000)

    You could add code like this to your macro:

    <pre> Dim sFilename As String
    sFilename = "C:Test.txt"
    If Dir(sFilename) <> "" Then Kill sFilename</pre>


    Change the file name as appropriate

    Steve

  3. #3
    New Lounger
    Join Date
    Jan 2004
    Posts
    21
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: FTP to Unix (2000)

    Thanks Steve,

    but because this is a Unix server, I cant use the normal dir() function - I have to use Unix code, which is where I become lost....

    Thanks
    Jenny

  4. #4
    Silver Lounger
    Join Date
    Jan 2001
    Location
    Brantford, Ontario, Canada
    Posts
    2,391
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: FTP to Unix (2000)

    The command 'ls' is the linux equivalent. Would that work in Unix??
    Christopher Baldrey

  5. #5
    Super Moderator jscher2000's Avatar
    Join Date
    Feb 2001
    Location
    Silicon Valley, USA
    Posts
    23,112
    Thanks
    5
    Thanked 93 Times in 89 Posts

    Re: FTP to Unix (2000)

    I suspect you need to use the command syntax of the FTP program, no?

    In Windows XP, the built-in FTP client uses these commands:

    ls filespec
    dir filespec

    either will return a string containing "The system cannot find the file specified." but the details of the rest of the string depend on whether the client is in verbose mode.

    delete filespec
    rename filespec

    do what you would expect. Your FTP server may differ. <img src=/S/smile.gif border=0 alt=smile width=15 height=15>

  6. #6
    New Lounger
    Join Date
    Jan 2004
    Posts
    21
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: FTP to Unix (2000)

    Thanks everyone. After lots of testing, it seems that the problem is my rights on the Unix server.... it seems that to overwrite a file you need to have delete access. I discovered this because when I created a new directory on the Unix server (and therefore had full rights to it) I was able to overwrite an existing file.

    Thanks again for all your help!
    JB

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •