FTP download file of same names

amit srivastava133

Distinguished
Jan 6, 2011
2
0
18,510
I have to write a batch script which download file from ftp server(unix environment) which contain several same name file with different modified date. Batch file should take two parameters file name and last modified date.that script go to server and match file name according to its lastmodified date and download it to windows environment . Please help
 
Well, you can't have the same filename on two files in the same directory, so I'm going to guess that there are multiple directories in question. If this isn't the case, you have one odd Unix system. Last time I saw multiple files with the same name, I was working with a VAX cluster.

If you know all of the directory names in advance, you can use the "cd" command in FTP to navigate around and the "ls -l" or "dir" command to check file dates. If you don't know the directory names, you have a piece of work to do a "dir" in the root directory, extract the names of all subdirectories and the dates of all files with that name, and recurse.

By any chance, is the file "date" part of the actual name? Like "useful.data.20101211" and "useful.data.20101214"?
 

amit srivastava133

Distinguished
Jan 6, 2011
2
0
18,510
hi,
same name files are in a single directory.for example in directory /PQR file are
abc_pqr 12/29/2010
abc_pqr 12/24/2010
abc_pqr 12/25/2010
I want a perticular file from ftp server of abc_pqr 12/24/2010 date. Please help