Delete directory and files with subdirectorys with ftp command line

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Message
Author
r2du-soft
Posts: 68
Joined: 09 Sep 2011 12:13

Delete directory and files with subdirectorys with ftp command line

#1 Post by r2du-soft » 11 Sep 2017 17:45

Hi
How can Delete directory and files with subdirectorys with ftp command line?
For example i have a folder with name folderB1
In that folder is many files and subfolders with files
My problem is that i dontknow subfolders name for delete thats one by one
Now how can Delete directory and files with subdirectorys?



r2du-soft
Posts: 68
Joined: 09 Sep 2011 12:13

Re: Delete directory and files with subdirectorys with ftp command line

#4 Post by r2du-soft » 12 Sep 2017 07:53

Image

my problem this...
when i want remove directory,then show me message directory not empty...
i how can delete AAA folder with sub directory and files?
i see links but i have problem again...
is possible give me example?
thanks

Compo
Posts: 600
Joined: 21 Mar 2014 08:50

Re: Delete directory and files with subdirectorys with ftp command line

#5 Post by Compo » 12 Sep 2017 08:12

You will likely need to run delete or mdelete first to remove files before removing the directory with rmdir.

It doesn't look however like there is a mrmdir command so you may only be able to remove a single one at a time.

r2du-soft
Posts: 68
Joined: 09 Sep 2011 12:13

Re: Delete directory and files with subdirectorys with ftp command line

#6 Post by r2du-soft » 12 Sep 2017 08:41

Is true
But when i dont know sub folders name,how can goto folder for remove files?

aGerman
Expert
Posts: 4678
Joined: 22 Jan 2010 18:01
Location: Germany

Re: Delete directory and files with subdirectorys with ftp command line

#7 Post by aGerman » 12 Sep 2017 09:34

Probably something like that:

Code: Select all

cd AAA
prompt
mdel *
cd ..
rmdir AAA

Untested though.

Steffen

r2du-soft
Posts: 68
Joined: 09 Sep 2011 12:13

Re: Delete directory and files with subdirectorys with ftp command line

#8 Post by r2du-soft » 12 Sep 2017 11:23

Yes i test this and work for delete files in folder
But how can delete folders that do not know their name؟

For full example see this:
In folder AAA is several folders and files
If i dont know folders name cant goto inside folder to be empty that and after remove empty folder
My problem is find folders name for delete folder files and after delete folder

aGerman
Expert
Posts: 4678
Joined: 22 Jan 2010 18:01
Location: Germany

Re: Delete directory and files with subdirectorys with ftp command line

#9 Post by aGerman » 12 Sep 2017 11:28

I'm not aware of any possibility to do that using the Windows FTP command. Most likely you have to find a 3rd party utility for this task.

Steffen

r2du-soft
Posts: 68
Joined: 09 Sep 2011 12:13

Re: Delete directory and files with subdirectorys with ftp command line

#10 Post by r2du-soft » 12 Sep 2017 12:29

Thanks for the help
Is possible do this work with any software with call with cmd to send parameters?

aGerman
Expert
Posts: 4678
Joined: 22 Jan 2010 18:01
Location: Germany

Re: Delete directory and files with subdirectorys with ftp command line

#11 Post by aGerman » 12 Sep 2017 12:48

Google told me something about NcFTP which seems to support option -r for rmdir.

Steffen

r2du-soft
Posts: 68
Joined: 09 Sep 2011 12:13

Re: Delete directory and files with subdirectorys with ftp command line

#12 Post by r2du-soft » 21 Sep 2017 09:50

NcFTP good work rmdir -r but i have another problem...
in ftp command i can use like this:

Code: Select all

@echo off 
echo open FTPADDRESS> DeleteDirectory2.txt
echo FTPUSERNAME>> DeleteDirectory2.txt
echo FTPPASSWORD>> DeleteDirectory2.txt
echo CD AAA>>DeleteDirectory2.txt
echo prompt>>DeleteDirectory2.txt
echo mdelete *>>DeleteDirectory2.txt
echo cd ..>>DeleteDirectory2.txt
echo RMDIR AAA>>DeleteDirectory2.txt
echo disconnect>>DeleteDirectory2.txt
echo quit>>DeleteDirectory2.txt
ftp -s:DeleteDirectory2.txt
del DeleteDirectory2.txt




is possible i run commands in NCFTP like this? write code in a text file and call them with NCFTP?

r2du-soft
Posts: 68
Joined: 09 Sep 2011 12:13

Re: Delete directory and files with subdirectorys with ftp command line

#13 Post by r2du-soft » 22 Sep 2017 07:44

not possible remove a directory without name in ftp?

in ncftp i need like this:

Code: Select all

@echo off
echo open -u FtpAddress> ftpcmd.txt
echo FtpUsername>> ftpcmd.txt
echo FtpPassword>> ftpcmd.txt
echo mkdir AAA>>ftpcmd.txt
echo cd AAA>>ftpcmd.txt
echo mkdir 1A>>ftpcmd.txt
echo mkdir 2B>>ftpcmd.txt
echo mkdir 3C>>ftpcmd.txt
echo cd ..>>ftpcmd.txt
echo cd AAA>>ftpcmd.txt
echo rm -r *>> ftpcmd.txt
ncftp -f ftpcmd.txt
del ftpcmd.txt


but not worked!

aGerman
Expert
Posts: 4678
Joined: 22 Jan 2010 18:01
Location: Germany

Re: Delete directory and files with subdirectorys with ftp command line

#14 Post by aGerman » 22 Sep 2017 10:49

Sorry, but neither do I know NcFTP (I was just googling for you) nor do I own any FTP server share where I could test it. Just follow their documentation links
http://www.ncftp.com/ncftp/

Steffen

r2du-soft
Posts: 68
Joined: 09 Sep 2011 12:13

Re: Delete directory and files with subdirectorys with ftp command line

#15 Post by r2du-soft » 22 Sep 2017 13:18

aGerman wrote:Sorry, but neither do I know NcFTP (I was just googling for you) nor do I own any FTP server share where I could test it. Just follow their documentation links
http://www.ncftp.com/ncftp/

Steffen



I tried by: http://www.ncftp.com/ncftp/
but I did not succeed
i send to you in PM a FtpAddress and Username and Password for testing codes
If possible test ncftp or ftp for delete folder with sub folders
For example i have a directory with name 'Root' and in that is many folders without file
I want to delete directory 'Root' with all sub directorys (if i don't know sub folders names)

Post Reply