LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 03-28-2012, 08:38 AM   #1
Biomouse
LQ Newbie
 
Registered: Feb 2011
Posts: 4

Rep: Reputation: 0
FTP renaming


Is there a way that when you ftp it uses a temporary name until the upload/download is complete and then only renaming it to the correct filename
like the way a zip file is called zi..... till the zip is complete.
 
Old 03-28-2012, 11:53 AM   #2
colucix
LQ Guru
 
Registered: Sep 2003
Location: Bologna
Distribution: CentOS 6.5 OpenSuSE 12.3
Posts: 10,509

Rep: Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976
Yes. Using the plain ftp command you can do something like this:
Code:
#!/bin/bash
#
file=testfile
ftp -n ftp.hostname << EOF
  user username password
  put $file .$file
  rename .$file $file
  bye
EOF
Despite the fact it is unsafe to keep a password in clear text inside a script, this is just to show you that you can upload a file with a different name by adding a second argument to the put command. Then you can simply use the rename command to change it back to the original name. In my example the put command just adds a leading dot to the file name to make it hidden (unless the ftp server has an alias to show hidden files by default).
 
1 members found this post helpful.
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Renaming a folder which is default folder for FTP account rjo98 Linux - Newbie 6 02-11-2011 10:30 AM
Using ls and renaming...... HELP Drigo Linux - Newbie 3 03-03-2010 05:52 PM
FTP script with user prompting/redirects/renaming tazer92 Linux - Newbie 1 05-13-2009 01:11 PM
Renaming Zmyrgel Linux - General 1 08-06-2006 08:59 AM
ftp server auto renaming? JustinHoMi Linux - Networking 0 12-07-2001 11:31 PM


All times are GMT -5. The time now is 04:23 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration