FTP Delete non empty directory

前端 未结 6 1740
走了就别回头了
走了就别回头了 2020-12-08 06:44

I am connected to a Unix server and I am trying to, via FTP, delete the directory dir with several files in it. If I use

ftp> delete dir/*


        
相关标签:
6条回答
  • 2020-12-08 07:06

    rmdir directoryName

    this directory must be in the current directory however.

    cheatsheet: http://www.cs.colostate.edu/helpdocs/ftp.html

    0 讨论(0)
  • 2020-12-08 07:07

    Use lftp to log into your server, this supports the rm -r command.

    lftp user, password server
    

    then:

    rm -r directory
    

    the -r stands for "recursive".

    info:

    • http://en.wikipedia.org/wiki/Lftp
    • http://en.wikipedia.org/wiki/Rm_%28Unix%29#Options
    0 讨论(0)
  • 2020-12-08 07:17

    I got it to work in two steps, on a server with restricted access, no SFTP, only FTP through commandline.

    Like this :

    mdelete folder_name/*
    rmdir folder_name
    
    0 讨论(0)
  • 2020-12-08 07:20

    $ ftp -i ...

    will turn off prompting on mdel, which is what you want. It can't be done inside ftp.

    0 讨论(0)
  • 2020-12-08 07:31

    I'm using Filezilla, and it deletes folders recursively. I believe the ftp does not have a command that recursively deletes folders.

    0 讨论(0)
  • 2020-12-08 07:32

    If you've hidden files or folders on your server (for example .folder), you have to set the lftp list-options to "-a".

    So this worked for me:

    $ lftp -u user,pass server
    > set ftp:list-options -a
    > cd /folder/to/be/empty/
    /folder/to/be/empty/> glob -a rm -r *
    
    0 讨论(0)
提交回复
热议问题