Looping in FTP session


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Looping in FTP session
# 1  
Old 08-26-2008
Looping in FTP session

Hi
I am trying rename multiple files in a remote location by connecting through FTP. How do i do this? I get error as for is not FTP command. I looked the FAQ for scripting but it is doesnt relate to my post.
Please help. Thanks

ftp -in >Error.log <<!
open $HOST
user $User $Pwd
for done_file in t*.txt
do
mv $done_file ${done_file}.done
done
bye
!
# 2  
Old 08-26-2008
create a list of the files you want renamed - call it filename
Code:
mv file1 file2.done
mv myfile anotherfile.done

Code:
echo "
open  $hostname
user $user $pwd
$(cat filename)
bye 
" |  /usr/bin/ftp -in > ftp.log

# 3  
Old 08-26-2008
Could you explain please i am new to unix shell. How do i create a list of the files as the files are at the remote server.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Using pipe in FTP session

Hi All , I want to use pipe in ftp session . Please let me know if there is any possibility I have done FTP to a remote host with proper username and password Now I want to take the latest file in a directory . The below is not workinf ftp> ls -lrt |... (4 Replies)
Discussion started by: Sandeep Lade
4 Replies

2. Shell Programming and Scripting

Odd looping issue with NET::FTP and Proftpd

Hello, I'm a UNIX SysAdmin at a large webhosting company and we have a vendor that provides a service which involves the ftp'ing of files from their servers to ours. They initiate FTP using a perl script with NET::FTP. When they try to transfer files (and delete files over ftp), there is... (3 Replies)
Discussion started by: tmmgeekette
3 Replies

3. Shell Programming and Scripting

running a script in a ftp session

Hi guys, I am using a script that run ftp and transfer file from my source server to the destination server. Since i have transferred my files to the destination server, now i want to run a script at the destination server. Could you please help me regarding how to run a script in a ftp... (7 Replies)
Discussion started by: jaituteja
7 Replies

4. UNIX for Advanced & Expert Users

For looping on FTP

Hi, I have a requirement, where i have to check multiple folders(number of folder may vary) for a file and fetch the file one at a time and load it. On the ftp part, I fetch the file, Copy it to Archive folder and then remove the original file for flist in $folder_list; do print -p... (6 Replies)
Discussion started by: SubbuUX
6 Replies

5. Shell Programming and Scripting

How to get latest file via FTP session

Hello , My requirement is as follows: I want to connect to a remote FTP server using FTP and then get the latest file from server location can u pls share code snippet for this ? Regards, Suresh (4 Replies)
Discussion started by: sureshg_sampat
4 Replies

6. Shell Programming and Scripting

executing commands through FTP session

Dears, i want to execute unix commands through FTP session those commands like grep XXXXX file name > new file tar new file ..... etc Please let me know how to so thank you (3 Replies)
Discussion started by: faiz
3 Replies

7. UNIX for Dummies Questions & Answers

FTP Session

In FTP session, how could know the present working directory in local machine? pwd command gives the present working directory for remote machine only. (2 Replies)
Discussion started by: siba.s.nayak
2 Replies

8. Shell Programming and Scripting

Running a script for every ftp session

Hello all, I have written a shell script which would prompt the user to enter some name and a folder would be created by that name. This script should run automatically when the users provide there credentials during a FTP session and for every FTP session. And after they have provided there... (5 Replies)
Discussion started by: h3llh0l3
5 Replies

9. Shell Programming and Scripting

display while in ftp session

Is there any command which displays date while i am in a ftp session? I tried the date command, but in vain ftp> date ?Invalid command ftp> Can someone please help me. Thanks (2 Replies)
Discussion started by: vivek_damodaran
2 Replies

10. UNIX for Dummies Questions & Answers

one time automated ftp session

How can an automated script be setup to run at a later time in the day. cron runs recurring tasks. I am interested in a one time process. I want to back up a number of files whenever I make changes to an application and ftp for backup purposes. The script to automate the zipping of files has... (1 Reply)
Discussion started by: msmkeml
1 Replies
Login or Register to Ask a Question