Remote renaming of a unix file via ftp


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Remote renaming of a unix file via ftp
# 1  
Old 05-30-2012
Remote renaming of a unix file via ftp

Hi all,

i'm just after some help regarding a batch script.

I'm wanting to create a windows batch script which will push a file from my pc to a unix (AIX) system via ftp. i have this part working fine but as the file i'm sending already exists i want the script to also take a sideways copy of the remote file and give it a .todaysdate extension, i can't seem to get this working..any ideas ?
# 2  
Old 05-30-2012
Rename the file locally prior to sending.

As always: stay away from ftp, it is insecure, it is prone to network attacks and you have to provide clear-text passwords for it to work. In most data centers ftp is positively forbidden - even forbidden to be installed.

I hope this helps.

bakunin
# 3  
Old 05-30-2012
I currently am renaming the file locally prior to running my script but i want to avoid doing this. Security is not an issue.
# 4  
Old 05-30-2012
Quote:
Originally Posted by forefather1977
I currently am renaming the file locally prior to running my script but i want to avoid doing this.
hmm, you want to replace a script on the ftp-clients side with one running (inside an ftp.session?) on the server side. This will probably gain you nothing in terms of complexity. Further, the options within ftp to manipulate files are quite limited, so you will have to resort to other means.

You could set up a cron-job which looks in a certain directory on the server side and if there is a file without extension then rename it to having an extension. Depending on how often you transfer files you can then transmit the files without extension, the cron job would dee them and rename them. This will not work if you have to transfer files more often than the cron job runs, so you will have to choose the interval matchingly.

I hope this helps.

bakunin
# 5  
Old 05-30-2012
When mentioning Operating Systems, please mention the exact version.

If you have a version of Windows which includes the rsh command, that increases your options because you can instruct Windows Batch to execute a unix script (or command) on the remote machine. The method can also be made passwordless with a suitable .rhosts file.
# 6  
Old 05-30-2012
Doesn't ftp have a move command which could do this?
# 7  
Old 05-30-2012
In my version it's the rename ftp command. In basic MSDOS Batch it is really painful to retrieve a directory listing with ftp and then decide which files to rename. It's much easier to write a unix Shell script to do the job (and the file transfers as well). I'm assuming that the process is initiated from the Windows end because of some scheduling reason.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Copying, renaming the file ftp it from windows to Linux

Hello my dear friends, Two file are auto generated from mon - fri at different directories on same windows box.Every day i have to copy the file, rename it (specific name)and ftp it to linux box specified directory. is it possible to automate this process,If yes this has to be done from windows... (1 Reply)
Discussion started by: umesh yadav
1 Replies

2. 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

3. Shell Programming and Scripting

FTP a File to a Remote Server

Hi, I'm fairly new to Linux and need help with a script to ftp a .csv file to a remote server. I can ftp the .csv file manually from my server to the remote server in the "/" location. When I execute the script I receive the following message Could not create file. Here's what I have for... (5 Replies)
Discussion started by: Computergal2104
5 Replies

4. Shell Programming and Scripting

FTP using script not working (for transfering file from a remote unix server to windows PC.)

hi, Im using the following code for FTP #!/usr/bin/ksh ftp -v -n "10.29.45.11" << cmd user "mahesva" "mahesva123" get rtl.tar quit cmd Below is the log when i run the above code ********************************** Connected to 10.29.45.11. 220 (vsFTPd 2.0.1) 530 Please login with USER... (20 Replies)
Discussion started by: dll_fpga
20 Replies

5. UNIX for Dummies Questions & Answers

Renaming a file (non unix person)

I am trying to move a file to a new file with a datestamp in the filename on a unix server using a script I am trying to write. I have searched this forum and have tried 100 different variations but cannot solve my problem. My requirement is: Rename archiveSF\sfglsoarian.txt to... (3 Replies)
Discussion started by: cavleader
3 Replies

6. UNIX for Dummies Questions & Answers

To ftp file on a remote server

I want to send some files in .gz format from my desktop to a remote server. What will be the procedure for that thanks (5 Replies)
Discussion started by: supercops
5 Replies

7. UNIX for Dummies Questions & Answers

Renaming the File in UNIX

I have many files in a particular folder(all ending with extension .F1.Test). I need a unix command that will change my file extension from .F1.Test to .csv I tried giving the command as "ren sample.F1.Test sample.csv", but i got the file as "sample.F1.csv" Example : I have the filename... (8 Replies)
Discussion started by: mazhar803
8 Replies

8. Cybersecurity

FTP Automation Windows <> Unix <> Remote

Hi All, I am a newbie to unix and scripting. I need to do the following job: 1. Create a batch file in windows that will call a script in a remote unix box. 2. The script now ftp files from the Remote windows machine and get them back to the local windows. Actually, I have written the script... (3 Replies)
Discussion started by: Ankur
3 Replies

9. Shell Programming and Scripting

FTP a file to a remote Server

Dear all, I am trying to push a data file to a remote Server. I am taking date variable from the database. The file I want to push looks like this in /tmp hostname.export.beforedate.dmp.gz for reading the date from the database i have a file get_date.sql which contains select... (2 Replies)
Discussion started by: shivaraj
2 Replies

10. UNIX for Dummies Questions & Answers

Remote execute a file via ftp

How can I execute a script on a unix server via ftp from a Windows machine?? Can't use cron/at to schedule the execution and don't want to open up a telnet session just to do it. I want to be able to kick it off after I send the script over on a nightly basis. Reason is script parameter changes... (4 Replies)
Discussion started by: giannicello
4 Replies
Login or Register to Ask a Question