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
smd-client(1)						 Sync Mail Dir (smd) documentation					     smd-client(1)

NAME
smd-client - receives diffs and performs actions SYNOPSIS
smd-client [-v|--verbose] [-d|--dry-run] [-t|--translator] [-l|--local-sync] [--rename-only] [--override-db dbf] endpoint mailboxes DESCRIPTION
smd-client needs to know a name (endpoint) for the client (that must not be used by others) and a list of mailboxes (directories). smd-client waits on stdin a mail dir diff. It attempts to execute these actions, eventually asking data printing commands on stdout and expecting the data on stdin. OPTIONS
-t --translator Specify a program to translate remote mailbox names to local ones. Note that the translator 'cat' (the identity program) is opti- mized away -l --local-sync Local synchronization, no changes is made to the db-file since smd-server takes care of it --rename-only Do not synchronize the mailboxes but generate the script '~/smd-rename.sh' to uniform the files names in the mailbox --override-db dbf Use dbf as the db-file -v --verbose Increase program verbosity (printed on stderr) -d --dry-run Do not perform any action for real NOTES
smd-client is a low level utility. You should use higher level tools like smd-pull(1) and smd-push(1) SEE ALSO
mddiff(1), smd-server(1), smd-pull(1), smd-push(1) AUTHOR
Enrico Tassi <gares@fettunta.org> 11 June 2012 smd-client(1)
All times are GMT -4. The time now is 11:19 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy