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
Solved

Copy via ssh

Posted on 2010-08-15
9
468 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
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
 
LVL 5

Expert Comment

by:eNarc
ID: 33443642
0
 

Expert Comment

by:brave2120
ID: 33443655
Use SCP command
0
The New “Normal” in Modern Enterprise Operations

DevOps for the modern enterprise offers many benefits — increased agility, productivity, and more, but digital transformation isn’t easy, especially if you’re not addressing the right issues. Register for the webinar to dive into the “new normal” for enterprise modern ops.

 

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
 
LVL 10

Expert Comment

by:nabeelmoidu
ID: 33443813
0
 
LVL 5

Expert Comment

by:eNarc
ID: 33444063
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 250 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 250 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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

How to remove superseded packages in windows w60 or w61 installation media (.wim) or online system to prevent unnecessary space. w60 means Windows Vista or Windows Server 2008. w61 means Windows 7 or Windows Server 2008 R2. There are various …
The purpose of this article is to fix the unknown display problem in Linux Mint operating system. After installing the OS if you see Display monitor is not recognized then we can install "MESA" utilities to fix this problem or we can install additio…
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

790 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