Sponsored Content
Top Forums Shell Programming and Scripting FTP mget * not working after change directory -cd Post 302526741 by oravikiran on Wednesday 1st of June 2011 11:14:44 AM
Old 06-01-2011
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 per mailbox (for ex:- "N0001" file in "TE.TZ.MBOX.XMIT.FPFD" mailbox) .
But if we have multiple files in mailboxes (for ex:- N0001,N0002 in"TE.TZ.MBOX.XMIT.FPFD" mailbox) the following script is not working correctly.

For example :-

if there are these two files in TE.TZ.MBOX.XMIT.FPFD mailbox
N0001
N0002

if there are these two files in TE.TZ.MBOX.XMIT.FPGD mailbox
N0003
N0004


after running the following script, Local dir "/ford/thishost/proj/batch/sonic/server/data/de/fpf" is having N0001 and N0002(good) but local dir "/ford/thishost/proj/batch/sonic/server/data/de/fpg" is still having N0001 and N0002(bad) but its not right as I am expecting N0003 and N0004.

somehow when there are multiple files in each mailbox change directory (cd) command is not working.

Could you please let me know if you have any idea how to fix this issue,

Many thanks in advance.


FTP script is :-

ftp -n <<_LABEL
open ftp.sun.com
user $USERID $PSSWRD
has
cd 'TE.TZ.MBOX.XMIT.FPFD'
lcd /ford/thishost/proj/batch/sonic/server/data/de/fpf
mget *
has
cd 'TE.TZ.MBOX.XMIT.FPGD'
lcd /ford/thishost/proj/batch/sonic/server/data/de/fpg
mget *
has
cd 'TE.TZ.MBOX.XMIT.FPAD'
lcd /ford/thishost/proj/batch/sonic/server/data/de/fpa
mget *
has
cd 'TE.TZ.MBOX.XMIT.ASVD'
lcd /ford/thishost/proj/batch/sonic/server/data/de/asv
mget *
has
cd 'TE.TZ.MBOX.XMIT.RVGD'
lcd /ford/thishost/proj/batch/sonic/server/data/de/rvg
mget *
has
cd 'TE.TZ.MBOX.XMIT.FPVD'
lcd /ford/thishost/proj/batch/sonic/server/data/de/fpv
mget *
has
cd 'TE.TZ.MBOX.XMIT.ASGD'
lcd /ford/thishost/proj/batch/sonic/server/data/de/asg
mget *
has
cd 'TE.TZ.MBOX.XMIT.AFGD'
lcd /ford/thishost/proj/batch/sonic/server/data/de/afg
mget *
has
cd 'TE.TZ.MBOX.XMIT.ASFD'
lcd /ford/thishost/proj/batch/sonic/server/data/de/asf
mget *
has
cd 'TE.TZ.MBOX.XMIT.FPPD'
lcd /ford/thishost/proj/batch/sonic/server/data/de/fpp
mget *
has
cd 'TE.TZ.MBOX.XMIT.VMGD'
lcd /ford/thishost/proj/batch/sonic/server/data/de/vmg
mget *
close
bye
 

9 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

mget (ftp command)

hey, I was wondering if its possible to use a complete path and file name using the mget command example mget /dir1/dir2/dir3/file.ext or get /dir1/dir2/dir3/file.ext because whenever i try its says file not found or permission denied..... but if i do cd dir1 cd dir2 cd dir3 mget... (2 Replies)
Discussion started by: Ganondorf
2 Replies

2. UNIX for Dummies Questions & Answers

Change to a new working directory...

I need to CD to a particular directory to check log files and interface files. Instead of typing the path manually, is there a way of getting a script to change my working directory to the one I need? Currently I have a script that CD's to the directories I need but a soon as the script exits,... (5 Replies)
Discussion started by: jagannatha
5 Replies

3. UNIX for Dummies Questions & Answers

How to change current working directory for dbx on UNIX?

How to change current working directory for dbx on UNIX? means I'll run pgm from one directory , but getcwd() should return path which I want to be, which is not d current dir :) (5 Replies)
Discussion started by: login0001
5 Replies

4. Shell Programming and Scripting

mget ftp command options

Hi, I am using mget ftp command to pull a bunch of zip files from Windows to local unix machines. It is working fine as follows. -rw------- 1 autosys autosys 614 Aug 19 13:13 02034128.zip -rw------- 1 autosys autosys 1866 Aug 19 13:13 02034127.zip -rw------- 1 autosys ... (1 Reply)
Discussion started by: spatra
1 Replies

5. Shell Programming and Scripting

Ftp-mget

For the below mentioned code..Files are getting transferred from first mget statement alone ie from /home/Arun/*EF01/...Could someone help me regarding this ftp -vn <<EOD >$LOG open user lcd ascii mget /home/Arun/*EF01/GLHEC* mget /home/Arun/*EF03/GLHEC* mget... (3 Replies)
Discussion started by: infernalhell
3 Replies

6. AIX

ftp mget directory

Hi, I have searched everywhere for an answer to this question but couldn't find one so I ask it here. From an AIX 5.3 machine I ftp to another AIX 5.3 server. I want to get all files and only files in a directory. This directory has a subdirectory with files in it. In ftp, I enter the... (5 Replies)
Discussion started by: bheinsius
5 Replies

7. Shell Programming and Scripting

problem with ftp mget

Hi I am trying to ftp all the files from a directory in server2 to server1 (both unix) The below code is in server1 ftpfile=/home/anitha/ftptxt echo cd mydir >>$ftpfile echo mget *.* >>$ftpfile cat $ftpfile | ftp -i server2 mydir is a directory in server2 and there are some test files in... (4 Replies)
Discussion started by: anijan
4 Replies

8. Shell Programming and Scripting

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... (6 Replies)
Discussion started by: thavamaniraja
6 Replies

9. Shell Programming and Scripting

Mget with SFTP is not working

hi Team, I am connecting from one (A) linux server to another(C)/any linux server by sftp on A linux server: sftp userid@C password: mget is Not working fine I am using mget to pull the files. it shows mget as invalid command. But from (B) Linux server to (C) /to Any server Linux... (15 Replies)
Discussion started by: johnsnow
15 Replies
ftpconfig(1M)						  System Administration Commands					     ftpconfig(1M)

NAME
ftpconfig - set up anonymous FTP SYNOPSIS
ftpconfig [ftpdir] ftpconfig -d ftpdir DESCRIPTION
The ftpconfig script is executed by the super user to set up anonymous FTP. Anonymous FTP allows users to remotely log on to the FTP server by specifying the user name ftp or anonymous and the user's email address as password. The anonymous users are logged on to the FTP Server and given access to a restricted file area with its own file system root. See chroot(2). The FTP area has its own minimal system files. This command will copy and set up all the components needed to operate an anonymous FTP server, including creating the ftp user account, creating device nodes, copying /usr/lib files, and copying timezone data. The passwd and group files set up have been stripped down to prevent malicious users from finding login names on the server. The anonymous file area will be placed under ftpdir. If the ftp user account already exists, then the current FTP area is used, and the system files in it are updated. All other files are left untouched. This command should be run to update the anonymous FTP area's configuration whenever a system patch is installed, or the system is upgraded. OPTIONS
-d Create a new or update an existing ftpdir without creating or updating the ftp user account. Use this option when creating guest FTP user accounts. OPERANDS
The following operands are supported: ftpdir The absolute pathname of the directory under which the anonymous FTP area is set up. EXIT STATUS
The following exit values are returned: 0 Successful completion 1 Improper usage of the command 2 Command failed ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Availability |SUNWftpu | +-----------------------------+-----------------------------+ |Interface Stability |Evolving | +-----------------------------+-----------------------------+ SEE ALSO
ftpaddhost(1M), in.ftpd(1M), useradd(1M), chroot(2), attributes(5) SunOS 5.10 1 May 2003 ftpconfig(1M)
All times are GMT -4. The time now is 11:32 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy