View previous topic :: View next topic
|
Author |
Message |
IndianBlues
New User
Joined: 23 May 2006 Posts: 6 Location: Cincinnati
|
|
|
|
I need some help to move files from one folder to another on the remote server. These files are text files on the remote server that we GET and process them through a job. Once processing is done we want to move them to another folder on the same server so that our vendor can park files for next day's processing. Is there any FTP command that does this move? In addition to moving to another folder we want to rename the files. |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
Why not just keep them on the mainframe after they are received/processed? Why do they need to remain on the remote server?
A couple of thoughts come to mind:
Have the remote system copy them when they are created and have the ftp job delete them from the original directory.
Have the mainframe ftp them to some other directory on the remote server after they have been received.
These aren't suggestions but are just something to get the thought process going. |
|
Back to top |
|
|
selvamsrinivasan85
New User
Joined: 09 Aug 2010 Posts: 31 Location: Chennai
|
|
|
|
Hi,
Move command for moving the txt file from one folder to another,
only if the folders are in the same directory/sub-directory:
Sample:
mv *.txt done <- * specifies all txt files
mv srini.txt done
- done is the folder in which txt files are moved.
once moved verify the folder whether particular txt file is present or not by using the below command.
ls done |
|
Back to top |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8696 Location: Dubuque, Iowa, USA
|
|
|
|
S.Srinivasan, please tell me where in the Communications Server bookshelf you find the MV command for FTP -- I don't see it when I look. MV is a Unix command, which is not valid to use in FTP as this script shows:
Code: |
EZA1772I FTP: EXIT has been set.
EZA1554I Connecting to: ftp1.xxx.com xxx.xxx.xxx.xxx port: 21.
220 ftp1.xxx.com NcFTPd Server (licensed copy) ready.
EZA1701I >>> USER xxxxxxxx
331 User xxxxxxxx okay, need password.
EZA1701I >>> PASS
230-You are user #20 of 100 simultaneous users allowed.
230-
230 Restricted user logged in.
EZA1460I Command:
EZA1736I mv a b
EZA1618I Unknown command: 'mv' |
Since the original request was for an FTP command, your "solution" fails completely to satisfy the requirement.
Indianblues, you can either use REXEC to execute a script on the remote server to perform the needed operations as a separate step in your job after the FTP step completes, or you can follow one of Dick's suggestions. But there's not really any way using FTP to do moves and renames since FTP is for file transfers, not remote access. |
|
Back to top |
|
|
selvamsrinivasan85
New User
Joined: 09 Aug 2010 Posts: 31 Location: Chennai
|
|
|
|
Hi Robert,
You are right. mv is a unix command and cannot be used in FTP. I am little bit confused as i am working on both these things.
So here is the answer:
First connect to Server using FTP.
Step1:
First use lcd command to set the local working directory of your machine. For example, if your text files are reside in d:\user directory use the below command
ftp> lcd d:\user
Step2:
Use cd command to set the working directory on the remote machine/server. Sample one is given below
ftp> cd /tmp
Step3:
Type ascii, as you are going to move only text files. if you want to move binary files type binary.
ftp> ascii
Step4:
Move the text files...
ftp> mput *.txt < for moving all txt files
ftp> put srini.txt < for moving text file named srini.
Step5:
use dir command to verify the moved files
ftp> dir *.txt < to verify all txt files
ftp> dir /user/local/bin < to verify files on particular directory of remote machine. |
|
Back to top |
|
|
selvamsrinivasan85
New User
Joined: 09 Aug 2010 Posts: 31 Location: Chennai
|
|
|
|
Hi,
Forget to mention. If you want to rename files, you have to get the files from the server to your local machine first. then, rename it and move to the server back.
command for receiving files.
ftp> mget *.txt < for receiving all text files to your local machine.
ftp> get srini.txt
ftp> get /user/srini.txt |
|
Back to top |
|
|
PeterHolland
Global Moderator
Joined: 27 Oct 2009 Posts: 2481 Location: Netherlands, Amstelveen
|
|
|
|
Is it only me being utterly flabbergasted by using a mainframe to move
files on unix/windows or any other non mainframe box around? |
|
Back to top |
|
|
Akatsukami
Global Moderator
Joined: 03 Oct 2009 Posts: 1788 Location: Bloomington, IL
|
|
|
|
Of course it's only you; the rest of us realized long ago that PCs are useless toys |
|
Back to top |
|
|
PeterHolland
Global Moderator
Joined: 27 Oct 2009 Posts: 2481 Location: Netherlands, Amstelveen
|
|
|
|
Akatsukami wrote: |
Of course it's only you; the rest of us realized long ago that PCs are useless toys |
Thats why im using mainframe FTP to comment on this site. |
|
Back to top |
|
|
|