1,380 pts.
 FTP- options for receiving files
Hello all,

We have an FTP client who is putting 4 files at a time on  their server folder for us to pick up. I am running into a little issue and am looking for options. 

They will not delete the files from their folder after we get them.

We do not have authority to delete them from their folder after we get them.

If I try to just download everything again, my ftplog shows that the files already exist on our IFS.  This is true for four files, but there are four new files I need to get.

Files will just keep stacking up and download times and processing time on our end will grow as time goes on.

Is there a way to 'select' the last four files that were loaded to their folder?

Here is an example of the 'unique' file name.

> mget *.csv                                                              227 Entering Passive Mode (204,16,136,72,13,159)                          150 Here comes the directory listing.                                     226 Directory send OK.                                                    Path already exists: /home/test/20120405-103602_LoadMaster_040512103326.csv Specify REPLACE as a subcommand option. 

More info on how I'm doing this download.

CLP does a   STRTCPFTP  RMTSYS(*INTNETADR) INTNETADR and uses a text file to process the needed steps once connected to the ftp server.

namefmt 1    lcd /home/test cd /out      mget *.csv   QUIT                                  

 

Thanks,

Nick



Software/Hardware used:
AS400, V5R4 FTP mget
ASKED: April 6, 2012  5:39 PM
UPDATED: April 11, 2012  2:18 AM

Answer Wiki:
Do you have the authority to RENAME the files you pickup? This is something we do so we know what has been processed. We add an extenstion that is the initials of our Corp. .TMG Then the next time we pick up files, we exclude those that end with .TMG
Last Wiki Answer Submitted:  April 6, 2012  6:59 pm  by  CharlieBrowne   33,720 pts.
All Answer Wiki Contributors:  CharlieBrowne   33,720 pts.
To see all answers submitted to the Answer Wiki: View Answer History.


Discuss This Question:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _


 

Maybe this will be more readable.

namefmt 1    
lcd /home/test
cd /out      
mget *.csv   
QUIT         
Path already exists: /home/test/20120405-103602_LoadMaster_040512103326.csv 
Specify REPLACE as a subcommand option.    
 1,380 pts.

 

how often does this run???

if daily, you could mget 20120406*.csv
or even hourly, mget 20120406-14*.csv

you would need to have a process update the control script file before you start the FTP session

 7,205 pts.

 

CharlieBrown, Bigkat – thanks for the prompt response.
I doubt I have anything but ‘read’ authority on their server. I could try that. That would be a good way.

Bigkat, not sure yet how often this will run. Most likely once a day, late at night for the current day. A guy here had also come up with that (20120406*.csv) plan.

Here is what I came up with.
Two connections.
First- connect, dir, quit. Read through the ftp log, parse the filename, chain out to a file with all previously downloaded filenames. If not found(we haven’t downloaded it before), update/write a different script file with the new-exact file name to get.
Second- connect, get new files, quit. Read the ftp log, parse the filenames, add them to the file with previously downloaded file names.

Then I can kickoff the conversion programs to build db files we can use.
I think it is a plan, just had to think on it a bit.
How does that sound?

You two probably have the easier way and less coding now that I think about it. I will check on the rename authority. If not, I will use the current date to change the script file.

 1,380 pts.

 

CharlieBrown,
How do you know the file name to rename inside the ftp session?
mget 20120406*.csv
rename 20120406*.csv 20120406*.PRX <<<<would this work?

Kinda a combination of both suggestions.
Nick

 1,380 pts.

 

Here is what I came up with. …

If only read authority exists, your two-part FTP solution was pretty much what came to mind for me.

Tom

 110,135 pts.

 

Well, the rename is not exactly right.
The server said RNFR not correct. My believe is that it does not like the ‘*’. It seems like the tofile (RNTO) would need to be the whole name of the file ‘ 20120405etc_and_so_on.prx’. I haven’t found any examples on the rename command.
Interactively, I typed rename and hit enter. The server asked for the fromfile name, then the tofile name. It still did not like the ’20120405*.csv’ as the from file name. Maybe rename just will not accept generics.
This will keep me from bringing in all files in the folder each day. I would still love to rename as I pull them (just to prove that I can).

BigKat, I did have a pgm to update the script for the put operation. I copied/changed for the get operation. thx.

 1,380 pts.

 

When I mget 20120405*.csv, I get:

Path already exists: /home/tms/20120405-103602_LoadMaster_040512103326.csv
Specify REPLACE as a subcommand option.      

How much of the pathname/filename is checked on the IFS? The whole name is unique but the first 19 characters are the same as existing files on the IFS.

 1,380 pts.

 

We do a 3 step process
1. retrieve a DIR
2.Read the DIR to determine what files to puul
3. Go back and rename the files that we pulled.

 33,720 pts.

 

250 Rename successful.

Here is the short of it.
mget 20120405*.csv
read the log file, grab the filenames that were downloaded.
rebuild a script file to reconnect to their server and rename each file downloaded.
Kick off the mapping programs.

thanks everyone.

 1,380 pts.

 

It occurs to me that we all talked about how to help about renaming those files, but not about making sure that just because he CAN rename them, that he SHOULD.

If the client is keeping the files there for a reason (auditability, other people need to download them too, etc.), renaming them could cause them problems.

 7,205 pts.

 

That is a possibility. It should not be a problem for them.

 1,380 pts.

 

…how to help about renaming those files…

My original comment assumed that the files wouldn’t be renamed on the server. If renaming is done at all, the files should only be renamed on the client after being downloaded.

Tom

 110,135 pts.

 

Hi Is this sorted out…Is not let me know, then I’ll add my comments

 365 pts.