In FTP, how do I copy a remote file to other directories - ftp

Using FTP commands I want to upload a large file once and then copy that file to many directories on the remote FTP server. All the copy commands seems to relate to copying from local to remote or the other way around.
Is there an FTP command to copy remote to remote?

are you trying to move the file? if yes, you can do it using rename command to move the file, as for copy i guess you still have to do the the get,send from local-remote way.
as for move command should be something like this
rename /oldpath/file2move.txt /newpath/file2move.txt
Basically just rename your file path that is infront of the file that you wish to move.

As far as I know, there is no such command available in FTP protocol. There are some extensions to SFTP protocol to do this (and, having SSH access, you can issue cp commands), but SFTP is not an FTP.

Related

Upload files to SFTP server and delete or archive the source files afterwards

I can't figure out a way to automatically sync files with an SFTP server that will do the following.
Syncs files from local PC to the SFTP
After upload deletes the file on the local PC and keeps SFTP file or
After upload moves the file that has been uploaded to another file for review.
I've tried using Ftpbox but it doesn't have the options.
WinSCP but couldn't find a script that would work.
Remote-Sync but didn't have the options.
If just want to move local files to a remote folder, use the WinSCP put command with the -delete switch.
A full Windows batch file would be like:
winscp.net /log=upload.log /command ^
"open sftp://username:password#example.com/ -hostkey=""ssh-rsa 2048 xxxxxxxxxxx...=""" ^
"put -delete C:\local\path\* /remote/path/" ^
"exit"
Have WinSCP generate the open command or even a complete batch file for you.
If you want to move/archive the local files to another local folder after the upload, it is more complicated.
See the official WinSCP example Moving local files to different location after successful upload.

FTP - automatically rename/move file on FTP server when it's downloaded

I need to make a script for an FTP server that will detect when a file is downloaded and then either rename or move or delete that file to prevent it from being re-downloaded. Is there a way to do this by storing a file on the FTP server that will always be looking for when a file is downloaded, and then executing that process? I assume it could be done with a bash script, but I dont know enough about them to know if it can be constantly running/checking for if a file is downloaded.
Thanks!

How to run batch file after file download (from Linux to Windows) throught FTP in Windows

I am doing file copy from Linux to Windows share through FTP.
Once copy is done I am moving it to isilon storage which is shared on network path (manually).
Now I have created a batch file, which will do copy from FTP shared path to network path.
So how can I start batch file after FTP download? How can I automate it completely?
from Linux
ftp -n ip
user "user" "pwd"
put app.tar.gz
Once it is done i want to move it network shared path
Just use the copy command in a batch file, after the ftp.exe finishes:
ftp.exe -s:download.txt
copy c:\dowloadtarget\myfile.txt \\server\share\target\myfile.txt
You can run the copy even from the FTP script (the download.txt), if you need it for some reason. Use the ! (escape to shell) command.
get /remote/path/myfile.txt c:\dowloadtarget\myfile.txt
! copy c:\dowloadtarget\myfile.txt \\server\share\target\myfile.txt
But why don't you download the file directly to the shared folder?
get /remote/path/myfile.txt \\server\share\target\myfile.txt

503 RNFR command not understood

I'm using a (cheap branded) local media station as an FTP server and I'm using FIleZilla to transfer files to it.
When I try to move or rename a file located on the media station, I'm getting
Command: RNFR [filename]
Response: 503 Command not understood.
I don't know whether this is because of an old or corrupted FTP version (it's a device older than 5 years and I think there are no updates available).
Is there an alternative to perform FTP rename or move commands?
Is there an alternative to perform FTP rename or move commands?
If you have telnet or SSH access to the machine you could do the renaming their. If not you might try to use the FTP SITE command with "mv from-name to-name". But I doubt that the server will support this if it does not even support the standard way of FTP to rename files.
Apart from that the only alternative is probably to download the file, remove it on the server and upload it again with a different name.

FTP Batch file moving remote files

I have an FTP batch file that uses DOS commands to pull down some files. After I'm done pulling the files down, I would like to move the files to an archive directory on the remote server. What FTP DOS commands do I use to accomplish this?
*I wasn't clear at first but this move has to take place on the remote server.
before you pull the files down, you can use the lcd (local cd) command to move to your archive directory and then pull them down directly there. you can then lcd back to your working directory.
otherwise you can perform the move in your bat after your ftp session is completed.
edit:
in the case that your archive server is remote, your best bet is to finish your ftp session and then perform the move in your .bat.
ftp has a rename command, that should move files remotely. I haven't tried it though

Resources