FTP files from different directory from remote server to one directory in local


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting FTP files from different directory from remote server to one directory in local
# 1  
Old 12-15-2011
FTP files from different directory from remote server to one directory in local

Hi All,
I want to search for .log files from folders and sub folders in remote server and FTP them to one particular folder in the local machine. I dont want to copy the entire directory tree structure, just have to take all the .log files from all the folders by doing a recursive search from the remote directories using FTP and place it to one particular folder in the local

Please suggest.

Thanks,
dass
# 2  
Old 12-15-2011
There is no "recursive search" feature of ftp.

This is a pre-emptive solution without properly stating the problem or anything about the computers.
# 3  
Old 12-16-2011
the FTP script i have is
Code:
ftp -ni 2>$RUNNUM.log <<! 
       open $REMOTESERVER
       user $USERID $TPPWD
       cd $REMOTEDIR
       mget *.xml
       quit
!

with the above I can get the files from one directory, but my directory structure is as below
Code:
REMOTEDIR= /home/sales
with in sales I can have many subfolders like
/home/sales/Jan
/home/sales/feb
/home/sales/march
and even those folders can have subfolders like /home/sales/Jan/abc

I want to do a recursive search in the remote directory and look for .xml files from all the subfolders inside sales folder and ftp those xml files to my local machine.

Last edited by methyl; 12-16-2011 at 10:59 AM.. Reason: pleases use code tags for code and data
# 4  
Old 12-16-2011
Using just ftp for this task would be the very last resort. Navigating an unknown directory tree with ftp is really difficult.

Do you have better software like Remote Shell , Remote Copy etc. .?
Do you have administrative access to both computers?


The whole process would better driven from the remote computer end.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Unable to ssh and list files in local directory from remote.

#!/bin/bash script_work_dir="/home/websys/TEST_dpi_42_file_trnsfer_engine/PORT22/script_work_area" script_config_dir="/home/websys/TEST_dpi_42_file_trnsfer_engine/PORT22/script_config" dpi_sourceServerList=$script_config_dir"/dpi_sourceServerList" dpi_srvr_42="rtm@1.1.1.1"... (8 Replies)
Discussion started by: sadique.manzar
8 Replies

2. Shell Programming and Scripting

How can I check, if on remote server directory is empty or have files?

I have a script, which is supposed to run 1 day of the month, connect to remote server certain directory, find files, tar the, and copy find . -ctime -1 | tar -cvf transfer_dmz_start_monthly.tar *${Today}*.*; if then echo "Cannot create a tar file, the terminated... (2 Replies)
Discussion started by: digioleg54
2 Replies

3. Shell Programming and Scripting

Shell script to find the GB files in /tmp directory in remote server

Hi, i need help on shell scripting. Main intention of the script is step 1: ssh to remote server Step 2: cd /tmp in remote server Step 3: in tmp i want to grep only files and directories which are in GB sizes All the servers list file is - tmpsrv.txt vi tmpsrv.txt ... (17 Replies)
Discussion started by: kumar85shiv
17 Replies

4. Solaris

Ftp a directory to another server from the local server what is the command

ftp a directory to another server from the local server what is the command (2 Replies)
Discussion started by: PMoore
2 Replies

5. Shell Programming and Scripting

How to transfer file from Local PC to UNIX Directory without FTP?

Dear All, i am trying to get the file from windows location to unix location without using FTP and neither thru entering the user id and password. I have one unix form which is running on web application and user is entering the location and file name there now i know the file name and path. So i... (8 Replies)
Discussion started by: ripudaman.singh
8 Replies

6. Shell Programming and Scripting

Replicate remote directory to local directory with ftp

I have system that generate files every 1 hours , i only have ftp connection from my local server to remote . $ ls -al -rw-r--r-- 1 water None 0 Feb 7 18:09 a.0800 -rw-r--r-- 1 water None 0 Feb 7 18:09 a.0900 -rw-r--r-- 1 water None 0 Feb 7 18:09 a.1000 is there any perl / php... (3 Replies)
Discussion started by: before4
3 Replies

7. UNIX for Dummies Questions & Answers

File listing from remote to local directory

Hello, I have a file at remote server. I have to select only current day's files that are dropped on ftp server. The files do not have date or timestamp on them. so I plan to get the file listing from remote server to the local server. Based on file listing date I can find out when the files... (2 Replies)
Discussion started by: pavan_test
2 Replies

8. UNIX for Dummies Questions & Answers

How to transfer file from Local PC to Unix Directory without FTP!!!

Dear Friends, How to transfer files from my local PC to Unix directory without using FTP. Scenario: Transfer/Upload a file from PC to unix using web browser without using FTP technologies. I heard something like sendunix and sendpc used to transfer files from unix to Desktop and... (1 Reply)
Discussion started by: kk_c2il2
1 Replies

9. Shell Programming and Scripting

preserving the timestamp of a file when copied from remote server to local server using ftp

Hi, I need to copy few files from remote server to local server. I write a shell script to connect to the remote server using ftp and go to that path. Now i need to copy those files in the remote directory to my local server with the timestamp of all those files shouldnt be changed. ... (5 Replies)
Discussion started by: arunkumarmc
5 Replies

10. Shell Programming and Scripting

FTP multiple files from remote server to local server

Hi, I am facing a weired problem in my FTP script. I want to transfer multiple files from remote server to local server everyday, using mget * in my script. I also, want to send an email for successful or failed FTP. My script works for file transfer, but it don't send any mail. There is... (2 Replies)
Discussion started by: berlin_germany
2 Replies
Login or Register to Ask a Question