IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

How to move files from one folder to another on FTP server?


IBM Mainframe Forums -> All Other Mainframe Topics
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
IndianBlues

New User


Joined: 23 May 2006
Posts: 6
Location: Cincinnati

PostPosted: Thu Oct 28, 2010 7:40 am
Reply with quote

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
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Thu Oct 28, 2010 7:52 am
Reply with quote

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
View user's profile Send private message
selvamsrinivasan85

New User


Joined: 09 Aug 2010
Posts: 31
Location: Chennai

PostPosted: Tue Nov 09, 2010 11:15 pm
Reply with quote

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
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8696
Location: Dubuque, Iowa, USA

PostPosted: Tue Nov 09, 2010 11:35 pm
Reply with quote

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
View user's profile Send private message
selvamsrinivasan85

New User


Joined: 09 Aug 2010
Posts: 31
Location: Chennai

PostPosted: Wed Nov 10, 2010 6:16 pm
Reply with quote

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... icon_smile.gif
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
View user's profile Send private message
selvamsrinivasan85

New User


Joined: 09 Aug 2010
Posts: 31
Location: Chennai

PostPosted: Wed Nov 10, 2010 6:34 pm
Reply with quote

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
View user's profile Send private message
PeterHolland

Global Moderator


Joined: 27 Oct 2009
Posts: 2481
Location: Netherlands, Amstelveen

PostPosted: Wed Nov 10, 2010 7:40 pm
Reply with quote

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
View user's profile Send private message
Akatsukami

Global Moderator


Joined: 03 Oct 2009
Posts: 1788
Location: Bloomington, IL

PostPosted: Wed Nov 10, 2010 8:18 pm
Reply with quote

Of course it's only you; the rest of us realized long ago that PCs are useless toys icon_wink.gif
Back to top
View user's profile Send private message
PeterHolland

Global Moderator


Joined: 27 Oct 2009
Posts: 2481
Location: Netherlands, Amstelveen

PostPosted: Wed Nov 10, 2010 8:21 pm
Reply with quote

Akatsukami wrote:
Of course it's only you; the rest of us realized long ago that PCs are useless toys icon_wink.gif
36_2_35.gif

Thats why im using mainframe FTP to comment on this site.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> All Other Mainframe Topics

 


Similar Topics
Topic Forum Replies
No new posts Write line by line from two files DFSORT/ICETOOL 7
No new posts Compare only first records of the fil... SYNCSORT 7
No new posts Merge two VSAM KSDS files into third ... JCL & VSAM 6
No new posts Joinkeys - 5 output files DFSORT/ICETOOL 7
No new posts How to append a PS file into multiple... JCL & VSAM 3
Search our Forums:

Back to Top