Change directory with wildcard in FTP server

Hi ,
I am looking for a command to change directory in FTP server with wildcard specified. Basically this is what i am trying.

localserver# ftp remoteserver
ftp> ls
41000_42000
42000_43000
ftp> cd 41*
550 CWD failed. '41*' : no such file or directory.

Could anyone please let me know how do i change the directory with wildcard specific?

Thanks

There is no syntax in ftp which allows wildcards in directory names. The ftp program is not unix shell and has its own syntax.

Maybe save the list of directories to a file in one ftp session, and then process the list in further ftp sessions.

Thanks Methyl.,

My requirement is to write a script to create a directory with the following criteria..

in the ftp server , say i have three directory as follows. I need to create a script in such a way that if i enter a number say 41452, the script should identify the directory correctly under which this number will fall below and it should create a directory named 41452 under that directory.

ftp> ls
41000-42000
42000-43000
43000-44000
ftp>

once i run the script , i should be able to see the directory named 41452 under 41000-42000.

Any help ?

Thanks..

What happens if the number you are given is 42000? Looks like it could fall under two different parent directories.

Hi,
that was the typo , the directory is
ftp> ls
41001-42000
42001-43000
43001-44000

I'd use expect. You can get a listing from the ftp server manipulate it as you see fit to get the parent directory, cd into it, and create the desired directory.

Before you ask... man expect. google expect. great stuff. I've used it a few times, but not familiar enough with it to give examples, hence the man and google comments.

The only catch is that the output of ls in the ftp protocol isn't strictly defined at all. One ftp daemon may just list filenames, a different program might give an ls -l style listing, and so forth.