?
Solved

Copy via ssh

Posted on 2010-08-15
9
Medium Priority
?
476 Views
Last Modified: 2013-12-06
Hi experts,

I want to copy some files from Windows to Linux(RHEL 5).
How can I do that with ssh command?
And when I copy, filename of each file will be added the date today.
Ex:
Windows        Linux(RHEL 5)
costumer  --> costumer-20100831

Please tell me the code to do that? Also the app to recognize ssh command in Windows?

Thank you very much folks.
0
Comment
Question by:softbless
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
9 Comments
 
LVL 5

Expert Comment

by:eNarc
ID: 33443593
there are many apps that use ssh, as it doesn't matter what platform your transfering to ssh is standard.

http://smartftp.com/
http://winscp.net/
http://putty.org/
http://sshexplorer.com/
http://openssh.org/

mac:
http://cyberduck.ch/
0
 

Expert Comment

by:brave2120
ID: 33443655
Use SCP command
0
Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

 

Author Comment

by:softbless
ID: 33443657
Hi eNarc,

First I say sorry. Actually I want a batch file on Windows.
So I can execute that batch file.

Thank you very much eNarc.
0
 

Author Comment

by:softbless
ID: 33444194
Sorry I reply my question,

I want to copy some files from Windows to Linux(RHEL 5) by execute a batch file.
How can I do that with ssh command in batch file?
And when I copy, filename of each file will be added the date today.
Ex:
Windows        Linux(RHEL 5)
costumer.txt  --> costumer-20100831.txt

Please tell me the code to do that? Also the app to recognize ssh command in Windows?

Thank you very much.
0
 
LVL 3

Accepted Solution

by:
kiitii earned 1000 total points
ID: 33444354
I would suggest you try out putty-installer.exe
There is a command line program called "pscp.exe"
Copy this file into C:\Windows\System32, so that you can run this command from anywhere.


Then you will need to setup your putty key, for keyless access to linux box.
c:\> pscp  customer.txt   root@linux-box-ip:/folder/  

Then create a script in linux to rename the new files into your desire filename. Schedule the script to run after "pscp" command.

===Auto rename script.sh===
#!/bin/sh
mv   customer.txt   customer-$(date +%F).txt
========================
0
 
LVL 3

Assisted Solution

by:berniep
berniep earned 1000 total points
ID: 33450506
in addition to using putty's pscp as mentioned above, add the following to your windows batch script to copy the file with your date tag:

for /f "Tokens=2-4 Delims=/ " %%i in ('date /t') do  set datetag=%%k%%j%%i
pscp file user@host:/path/file-%datetag%

if you want to inclue the time:
for /f "Tokens=1-2 Delims=: " %%i in ('time /t') do set timetag=%%i%%j
pscp file user@host:/path/file-%datetag%-%timetag%
0

Featured Post

Ask an Anonymous Question!

Don't feel intimidated by what you don't know. Ask your question anonymously. It's easy! Learn more and upgrade.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

After running Ubuntu some time, you will be asked to download updates for fixing bugs and security updates. All the packages you download replace the previous ones, except for the kernel, also called "linux-image". This is due to the fact that w…
Use this article to create a batch file to backup a Microsoft SQL Server database to a Windows folder.  The folder can be on the local hard drive or on a network share.  This batch file will query the SQL server to get the current date & time and wi…
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…

649 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question