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
CTL_MBOXLIST(8) 					      System Manager's Manual						   CTL_MBOXLIST(8)

 *

NAME
ctl_mboxlist - perform operations on the mailbox list database SYNOPSIS
ctl_mboxlist [ -C config-file ] -d [ -x ] [ -p partition ] [ -f filename ] ctl_mboxlist [ -C config-file ] -u [ -f filename ] ctl_mboxlist [ -C config-file ] -m [ -a ] [ -w ] [ -i ] [ -f filename ] ctl_mboxlist [ -C config-file ] -v [ -f filename ] DESCRIPTION
Ctl_mboxlist is used to perform various administrative operations on the mailbox list database. Ctl_mboxlist reads its configuration options out of the imapd.conf(5) file unless specified otherwise by -C. The configdirectory option is used to determine the default location of the mailbox list database. OPTIONS
-C config-file Read configuration options from config-file. -d Dump the contents of the database to standard output in a portable flat-text format. NOTE: In Cyrus versions 2.2.13 and earlier, the dump format did not include the mailbox type flags, breaking remote mailboxes (frontends, mupdate master, unified backends) when undumped. -x When performing a dump, remove the mailboxes dumped from the mailbox list (mostly useful when specified with -p) -p partition When performing a dump, dump only thise mailboxes that live on partition -u Load the contents of the database from standard input. The input MUST be in the format output using the -d option. NOTE: Both the old and new formats can be loaded, but the old format will break remote mailboxes. -m For backend servers in the Cyrus Murder, synchronize the local mailbox list file with the MUPDATE server. -a When used with -m, assume the local mailboxes file is authoritiative, that is, only change the mupdate server, do not delete any local mailboxes. USE THIS OPTION WITH CARE, as it allows namespace collisions into the murder. -w When used with -m, print out what would be done but do not perform the operations. -i When used with -m, asks for verification before deleting local mailboxes. -v Verify the consistency of the mailbox list database and the spool partition(s). Mailboxes present in the database and not located on a spool partition, and those located on a spool partition (directory containing a valid cyrus.header file) and not present in the database will be reported. Note that this function is very I/O intensive. -f filename Use the database specified by filename instead of the default (configdirectory/mailboxes.db). FILES
/etc/imapd.conf SEE ALSO
imapd.conf(5), cyrmaster(8) CMU
Project Cyrus CTL_MBOXLIST(8)
All times are GMT -4. The time now is 06:45 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy