• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 481
  • Last Modified:

Copy via ssh

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
softbless
Asked:
softbless
2 Solutions
 
eNarcCommented:
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
 
brave2120Commented:
Use SCP command
0
Get your Conversational Ransomware Defense e‑book

This e-book gives you an insight into the ransomware threat and reviews the fundamentals of top-notch ransomware preparedness and recovery. To help you protect yourself and your organization. The initial infection may be inevitable, so the best protection is to be fully prepared.

 
softblessAuthor Commented:
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
 
softblessAuthor Commented:
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
 
kiitiiCommented:
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
 
berniepCommented:
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

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now