![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| Windows & DOS: Issues & Discussions All Windows and DOS questions should go here as well. Discuss UNIX to Windows (Desktop or Server) here! |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| need script to connect sftp servers | kittusri9 | Shell Programming and Scripting | 1 | 05-10-2008 05:13 AM |
| how to connect sftp server using script | kittusri9 | Shell Programming and Scripting | 1 | 05-06-2008 07:12 AM |
| how to connect to windows from unix ? | guhas | Shell Programming and Scripting | 2 | 12-19-2005 05:37 PM |
| Connect from Windows Using SSH | aldowsary | AIX | 12 | 08-07-2005 03:12 PM |
| How do I connect windows xp to Linux Red hat unix | TRUEST | UNIX for Advanced & Expert Users | 7 | 11-21-2002 12:02 PM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
||||
|
How to connect SFTP(Linux) from Windows DOS
I need to write a batch script for file transfer from SFTP to Windows system. SFTP is on Linux system. I kept this code in batch file and executing it.. but not working.. Even i tried from Command prompt like this "open sftp.host.com" but getting error. Can anyone help with the code and tell me how to connect SFTP from command prompt.
Here is my sample code, open sftp.host.com <username> <password> lcd <test/test/../> cd /test/test/test/ get test.txt quit -- Thanks, Mohan |
|
||||
|
You need an SFTP-compatible executable on the Windows side. You can try the psftp.exe that comes with PuTTY. You would store the SFTP commands in a file, say sftpcommands.txt, and use psftp.exe -b sftpcommands.txt.
|
|
||||
|
Quote:
I went to command prompt and psftp.exe -b sftpcommands.txt, but it is i am getting this error "'pstfp.exe' is not recognized as an internal or external command, operable program or batch file". If i open but psftp.exe, it is asking for hostname, login and password. Which is working fine. Can you tell me how to execute that above command which you gave. -- Thanks, Mohan Tummalapalli |
|
||||
|
You will either need to add it to your PATH, or specify the full path to the location of the psftp.exe, e.g. "C:\Program Files\PuTTY\psftp.exe" -b "C:\Documents and Settings\Mohan\My Documents\sftpcommands.txt".
|
|
||||
|
Thanks it works. I can run my scripts using "C:\Program Files\PuTTY\psftp.exe" -b "C:\Documents and Settings\Mohan\My Documents\sftpcommands.txt".
I have another doubt it the same script, I need to rename file which iam getting from SFTP, i am not sure the file name which iam getting so iam using "*" but as example iam sending this "ren Test*.txt Test123.txt" Can you tell me how to rename with date format something like test123[DDMMYYYY][time]. -- Thanks, Mohan |
|
||||
|
Thsi isn't really a Unix related question, is it? :-)
Windows batch/command/cmd.exe scripting is one of the most ridiculous languages I have ever encountered. Anyway, something like this might work for you: Code:
for /f "tokens=1-3 delims=/ " %d in ('date /t') do ren test*.txt test%d%e%f.txt
|
|
||||
|
I should mention, you have to double the %s if you are putting this in a batch file, i.e.
Code:
for /f "tokens=1-3 delims=/ " %%d in ('date /t') do ren test*.txt test%%d%%e%%f.txt
|
| Sponsored Links | ||
|
|
![]() |
| Bookmarks |
| Tags |
| sftp, sftp windows |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|