sftp file renaming


 
Thread Tools Search this Thread
Operating Systems Solaris sftp file renaming
# 1  
Old 01-26-2012
sftp file renaming

Hi Admins,

I am trying to get a file with different name including date format using sftp.

For example --> get test.bak auto`date +"%Y%m%d"`err

Here i am trying to get the file test.back with name auto20120126err

But file is copied with the name auto`date --> date is not printing

Please suggest how to get the name with date format.

Regards
Pavan
# 2  
Old 01-26-2012
spaces in a unix filename will cause you big trouble later on, don't do it, it is a windows-thing.
If you have ssh keys setup:
Code:
# 
newname="auto_"
dt$( date +%Y%m%d)
sftp someplace.com <<EOF
 get myfile ${newname}.${dt}
 exit
EOF

Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

Error while renaming the file in SFTP Session

Hi All Below is the script I am trying to execute to rename a file in an SFTP session. It is in GNU/Linux. This script is for generic use and so I am passing arguments. Everything in the script works fine except "reading the filename in SFTP session" In the below script the... (2 Replies)
Discussion started by: sparks
2 Replies

2. Shell Programming and Scripting

SFTP batch not renaming file with "put"

I have a .ksh script that creates an sftp batch file and runs it through sftp. It works except for one thing. If I try to "put" to a different name, it doesn't use the specified remote name...it still "puts" the original local name. I've tried both of these, and neither work...it will always... (4 Replies)
Discussion started by: dbiggied
4 Replies

3. Shell Programming and Scripting

Renaming multiple files in sftp server in a get files script

Hi, In sftp script to get files, I have to rename all the files which I am picking. Rename command does not work here. Is there any way to do this? I am using #!/bin/ksh For eg: sftp user@host <<EOF cd /path get *.txt rename *.txt *.txt.done ... (7 Replies)
Discussion started by: jhilmil
7 Replies

4. Shell Programming and Scripting

Renaming the file

Hi guys, I have written a code to move my file from one directory to another directory, the file is in .csv format and i need to append a current date to the file. the prolem is date is getting appended after the file extension.. here is my code : cd /data/home/abc/xyz now=$(date... (7 Replies)
Discussion started by: azherkn3
7 Replies

5. Shell Programming and Scripting

Renaming file and check for the renamed file existence

Hi Am trying to move a file from one name to another When I do "ls" to check for the moved filename I can see the file but when I try the same with a script am unable.. I think am doing some pretty silly error.. please help.. toMove=`ls | grep -E "partition.+"` mv $toMove partition._org... (7 Replies)
Discussion started by: Priya Amaresh
7 Replies

6. Shell Programming and Scripting

bulk renaming of files in sftp using script

Hi, Am using sftp (dsa method) to transfer 20 files from one server(sftp) to another (local). After the transfer is complete the files in the sftp server has to be renamed from .txt extension to .done extension ( aa.txt to aa.done, bb.txt to bb.done and likewise...). I tried rename command... (4 Replies)
Discussion started by: Sindhuap
4 Replies

7. Shell Programming and Scripting

Renaming a file while using SFTP

Hi All, I have a script which works perfectly for using SFTP commands. I use SFTP -b batchfile remoteuser@remoteserver. This batch file contains a command cd /dir1 put file1 I am wondering if there is a flag to rename a file on Remote server. I see the option rename file1... (6 Replies)
Discussion started by: Hangman2
6 Replies

8. Shell Programming and Scripting

File renaming from list of names contained in another file

I have to rename a large number of files so that the name of each file corresponds to a code number that is given side by side in a list (textfile). The list contains in column A the filename of the actual files to be renamed and in column B the name (a client code, 9 digits) that has to be... (7 Replies)
Discussion started by: netfreighter
7 Replies

9. Shell Programming and Scripting

Renaming a file use another file as a sequence calling a shl

have this shl that will FTP a file from the a directory in windows to UNIX, It get the name of the file stored in this variable $UpLoadFileName then put in the local directory LocalDir="${MPATH}/xxxxx/dat_files" that part seems to be working, but then I need to take that file and rename, I am using... (3 Replies)
Discussion started by: rechever
3 Replies

10. Shell Programming and Scripting

Renaming a file

I am a complete Unix newbie and I need some help! (Please...) I need to rename a file from the following format: Test_Test_EAR_1234.ear To the following: Test_Test_EAR.ear In other words, I need to remove everything after & including the final underscore up to the "." What is the best... (6 Replies)
Discussion started by: VeloLisa
6 Replies
Login or Register to Ask a Question