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.
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.