Change directory with wildcard in FTP server


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Change directory with wildcard in FTP server
# 1  
Old 05-26-2010
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
# 2  
Old 05-26-2010
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.
# 3  
Old 05-26-2010
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..
# 4  
Old 05-26-2010
What happens if the number you are given is 42000? Looks like it could fall under two different parent directories.
# 5  
Old 05-27-2010
Hi,
that was the typo , the directory is
ftp> ls
41001-42000
42001-43000
43001-44000
# 6  
Old 05-27-2010
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.
# 7  
Old 05-27-2010
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.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

Change sFTP home directory for particular user and from specific server

Hello Folks, Of course i came here for your favour :) How to set a defalult home directory for sFTP login ( at present users land in to their home directrory) when they connect from specific server. When server(A) sFTP's to Linux server(B) they land to thier home directory. I want... (5 Replies)
Discussion started by: Thala
5 Replies

2. Solaris

Ftp a directory to another server from the local server what is the command

ftp a directory to another server from the local server what is the command (2 Replies)
Discussion started by: PMoore
2 Replies

3. Shell Programming and Scripting

FTP files from different directory from remote server to one directory in local

Hi All, I want to search for .log files from folders and sub folders in remote server and FTP them to one particular folder in the local machine. I dont want to copy the entire directory tree structure, just have to take all the .log files from all the folders by doing a recursive search from the... (3 Replies)
Discussion started by: dassv
3 Replies

4. Shell Programming and Scripting

ksh(!93) for loop with wildcard and empty directory

I'm sure this is by design, but using something like for f in dir/* do echo $f done produces unexpected (to me) results if run against an empty directory. I'd have expected it to not execute the loop, but it actually calls it with f set to 'dir/*'. Now I know that I'm trying to protect... (2 Replies)
Discussion started by: spr00t
2 Replies

5. Shell Programming and Scripting

find command with wildcard directory

I want to look if there is any file inside a specific directory which was modified before 2 days. I wrote the find command, but the problem is there is one directory and that is a random directory generated by unix, so not sure on how to code for that on the find command. find... (5 Replies)
Discussion started by: srini0603
5 Replies

6. Shell Programming and Scripting

FTP mget * not working after change directory -cd

Hi everyone, I have an Linux FTP script to get files from different AS400 mailboxes and store in different local directories. I had to use mget * option becuase there is no fixed destination file name means filename can change. The following FTP script is working fine if we have single file... (5 Replies)
Discussion started by: oravikiran
5 Replies

7. Shell Programming and Scripting

WildCard serach for files in a directory

Hi i have a requirement to search for all files in a directory. the files will start as file1_*,file2_*,file3_* where the wild card character is a timestamp. so on a particular day i may get files like file1_1103120042 file1_1102010345 file2_1101093423 file3_1103120042... (3 Replies)
Discussion started by: Sgiri1
3 Replies

8. Solaris

How to change pwd during logging on ftp server?

Dear All, Could I change password while login in to ftp server(solaris 10)? I tried to use fileZilla and command prompt(window) to change my password but It can't. Do you have any suggestion ? Ps. I can't telnet and ssh to the server because of poicy for ftpuser. Thank in advance (3 Replies)
Discussion started by: unitipon
3 Replies

9. Linux

How to set up FTP Server with Active Directory

I've set up a FTP server (vsftpd) with some local user account and it works fine. Now i want to upgrade this FTP server with an ability that can authorize user through Active Directory. I do a search around our forum and it leads me to this page: Native LDAP, native Kerberos and Windows Server... (0 Replies)
Discussion started by: cthinh
0 Replies

10. Shell Programming and Scripting

Automated FTP from Unix to Active Directory Server

Automated Unix to Windows Active Directory FTP I have done many automated FTP scripts using the following logic: =============================== echo "Starting the FTP transfer..." { echo " open 192.168.1.100 user username password ascii put... (1 Reply)
Discussion started by: Cbish68
1 Replies
Login or Register to Ask a Question