FTP Delete non empty directory

2019-02-02 03:05发布

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/*

I get

550 Wildcard is ambiguous.

When I use

ftp> prompt off
Interactive mode off.
ftp> mdelete dir/*

I still get

550 Wildcard is ambiguous.

When I try

ftp> glob
Globbing on.
ftp> mdelete dir

I'm prompted for every file.

How can I easily delete/emptyAndDelete a directory without getting prompted for every file?

/Thanks

标签: unix ftp
6条回答
ゆ 、 Hurt°
2楼-- · 2019-02-02 03:36

Ok, 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:

查看更多
叼着烟拽天下
3楼-- · 2019-02-02 03:36

$ ftp -i ...

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

查看更多
虎瘦雄心在
4楼-- · 2019-02-02 03:41

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 *
查看更多
干净又极端
5楼-- · 2019-02-02 03:44

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
查看更多
We Are One
6楼-- · 2019-02-02 03:49

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

查看更多
趁早两清
7楼-- · 2019-02-02 03:55

rmdir directoryName

this directory must be in the current directory however.

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

查看更多
登录 后发表回答