current day remote files from FTP


 
Thread Tools Search this Thread
# 8  
Could you show what it does list when you do ls?

If it doesn't give you a complete listing, you can try ls -l, but remember, ftp is not a shell. You don't get the real ls command. This simple listing might be all you get.
# 9  
current day remote files from sftp

I logged in manually using sftp and I am able to view the file with ls -l

Code:
sftp>ls -l
-rwxr-xr-x    1 <userid>   <user id>            4743 Apr 11 11:01 test_file.txt
bye

Can you someone please let me know how do I get the entire file listing from remote server to the local server.

Thanks
Pavan

Last edited by methyl; 04-11-2012 at 05:43 PM.. Reason: code tags
# 10  
Code:
ftp >outputfile <<EOF
        $user
        $password
        cd $ftp_dir
        ls -l
        bye
EOF

The ending EOF must be at the beginning of the line. Don't even indent it. You can indent the rest as you please.

Last edited by Corona688; 04-11-2012 at 04:55 PM..
# 11  
current day remote files from ftp

I ran the following SFTP commands manually (on AIX server )

Code:
sftp -p $sftp_user@ftp_host
cd $ftp_dir
ls -l test_file.txt
-rwxr-xr-x 1 <user> <usr> 4746 Apr 11 12:13 test_file.txt
bye

Can someone please tell me how to I get the complete file listing to local server from remote server

Code:
-rwxr-xr-x 1 <user> <usr> 4746 Apr 11 12:13 test_file.txt

how do I get this complete listing,

Thanks
Pavan

Last edited by methyl; 04-11-2012 at 05:44 PM.. Reason: code tags
# 12  
sftp != ftp

Which do you need to use?
This User Gave Thanks to Corona688 For This Post:
# 13  
Please do type the ftp dir command requested in post #2. It is not always the same as ls in ftp (but it might be the same) .


Quote:
Can someone please tell me how to I get the complete file listing to local server from remote server
To answer your main question:
Within ftp there is a special syntax for the dir command to output the directory listing to a local file. This is useful to us.

These are ftp commands not Shell commands.

Make sure that your current local directory is suitable to receive the directory listing:
Code:
lcd suitable_dir

Then list the files in the directory and output to a file on the local server:
Code:
dir * mydirectory.lst

Once we have the directory listing we can find today's files. But, because date formats vary across the planet we need to see the date format.


Corona688 makes a valid point. Are you running ftp or sftp ?

Last edited by methyl; 04-11-2012 at 06:02 PM.. Reason: typos, layout, addenda etc.
# 14  
current day remot files from FTP

I am using sftp since I can't perform ls -l using ftp.
 

Previous Thread | Next Thread
Thread Tools Search this Thread
Search this Thread:
Advanced Search

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Error when connecting to remote server to find files with timestamp today's day

I am connecting to remote server and try to check if files with timestamp as Today's day are on the directory. Below is my code TARFILE=${NAME}.tar TARGZFILE=${NAME}.tar.gz ssh ${DESTSERVNAME} 'cd /export/home/iciprod/download/let/monthly; Today=`date +%Y%m%d`; if ;then echo "We... (1 Reply)
Discussion started by: digioleg54
1 Replies

2. UNIX for Dummies Questions & Answers

How to save current day files only?

i want to save current day file daily for this is am using below command. cp -p $(ls -lrt | grep "Apr 15" | awk '{print $9}' in order to script this part, i am saving date output in a file using below command date | awk '{print $2,$3}' >>t1 thru below command i want to list the file of... (7 Replies)
Discussion started by: scriptor
7 Replies

3. UNIX for Dummies Questions & Answers

Remote FTP Backup -Tar archive+ encrypt+ split to a remote ftp

I have a huge directoy(200+ gb) for backup. I want upload the tar file(split files) simultaneous to a remote ftp. (pipeline, stdout, stdin etc.) I don't want write a data to local hdd. I have a ssd hdd. thanks. this code doesn't work.( yes i know the problem is split command!) tar cvzf -... (8 Replies)
Discussion started by: tara123
8 Replies

4. UNIX for Dummies Questions & Answers

Move the files between Current day & a previous day

Hi All, I have a requirement where I need to first capture the current day & move all the files from a particular directory based on a previous day. i.e move all the files from one directory to another based on current day & a previous day. Here is what I am trying, but it gives me errors.... (2 Replies)
Discussion started by: dsfreddie
2 Replies

5. Shell Programming and Scripting

Command to list current day files only

Hi All, can anyone pls share the command to list the files of current day only. i want to check if there are any files in a particular directory which are not of current date. (6 Replies)
Discussion started by: josephroyal
6 Replies

6. UNIX for Dummies Questions & Answers

Can I copy files on remote server with ftp ?

I just realize the only way is to download and upload again.. is not possible to copy them remotely with the ftp protocol ? thanks (2 Replies)
Discussion started by: aneuryzma
2 Replies

7. Shell Programming and Scripting

Problem in Downloading one day old files from FTP site

HI, I'm downloading one day old files from ftp site. Below is my script ---------------------------- printf "open $HOST \n" > ftp.cmd printf "user $USER $PASSWD\n" >> ftp.cmd printf "bin\n" >> ftp.cmd #printf "cd /Models/\n" >> ftp.cmd printf "prompt\n" >> ftp.cmd printf "for oldfile... (4 Replies)
Discussion started by: shekhar_v4
4 Replies

8. Shell Programming and Scripting

Download previous day files through FTP

Hi All, I have a scenario where I need to download the previous day modified files from other server to my server through FTP . Could any one please send me the shell script for the same. I used the following but I dont know how to proceed after this. ftp -n -i -v $IP <<ENDOFinPUT >>... (3 Replies)
Discussion started by: sarathchandrach
3 Replies

9. Shell Programming and Scripting

delete files one day old in current month only

i want to delete files that are one day old condition is files should be of current month only ie if iam running script on 1 march it should not delete files of 28 feb(29 if leap year :-)} any modifications to find $DIR -type f -atime +1 -exec rm -f{}\; (4 Replies)
Discussion started by: maverick
4 Replies

10. Shell Programming and Scripting

How to compare prev day file to current day file

Hi all: I am new to this board and UNIX programming so please forgive if I don't explain something correctly. I am trying to write a script to keep track of our links, we link one program written for Client A to Client B's directory. What we want to do is to keep track of our linked programs... (1 Reply)
Discussion started by: Smurtzy
1 Replies

Featured Tech Videos