Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Moving Files via FTP

Status
Not open for further replies.

tbohon

Programmer
Apr 20, 2000
293
US
I have a script (.ksh on AIX) that connects to a remote server via ftp, does an mget * to capture the files and disconnects. It then does some manipulation of the files on the local machine after which it reconnects to the remote via ftp. At that point I want to move all of the files in the directory to a backup directory (one level below the current directory).

I've read man ftp and looked through the forums here but can't figure out how to do this. Normally I would just archive them on my local machine but the user wants them archived on the source (remote) system also. What a pain! :)

Thoughts/comments/ideas greatly appreciated.

And thanks in advance, as always.

Best,

Tom

"My mind is like a steel whatchamacallit ...
 
It sounds like you want to move files on the remote machine to a different directory...not really what ftp is used for. I would suggest using ssh or rsh to move the files. Depending on your environment, perl or expect could be used as well to perform remote command execution.
 
I'd come to that same conclusion. I think what I'll do is copy them from the remote to my ftp server, confirm that I have the correct number of files, connect again and move them to the backup directory on the remote server from my ftp box, then delete the original ones on the remote. Multiple connections but I think it'll work.

Appreciate the confirmation!

Best,

Tom

"My mind is like a steel whatchamacallit ...
 
you may wanna look into using 'rename' if your client/server supports it.
the way I see it the limitation might be that both the source and the ddestination directories cannot belong to different file systems.

vlad
+----------------------------+
| #include<disclaimer.h> |
+----------------------------+
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top