Unable to upload all files using wildcards with psftp - windows

I wish to upload all files in C:\Users\myuser\Downloads\SFTP folder on my local Windows to remote SFTP server myfolder directory.
I have multiple issues running sftp on Windows and achieving the above.
Below is my command:
C:\putty\psftp.exe -b C:\putty\sftp_commands.txt -l myuser -pw mypass 10.8.44.86
Here is my C:\putty\sftp_commands.txt file:
mkdir myfolder
cd myfolder
lcd "C:\Users\myuser\Downloads\SFTP"
put "C:\Users\myuser\Downloads\SFTP\*.*"
I get "unable to open" error despite the file exists on my local Windows.
This works when I change C:\Users\myuser\Downloads\SFTP\*.* to C:\Users\myuser\Downloads\SFTP\file1.txt.
C:\Users\myuser\Desktop>C:\putty\psftp.exe -b C:\putty\sftp_commands.txt -l myuser -pw mypass 10.8.44.86
Using username "myuser".
Pre-authentication banner message from server:
| EFT Server Enterprise 7.3.2.8
End of banner message from server
Keyboard-interactive authentication prompts from server:
End of keyboard-interactive prompts from server
Remote working directory is /
mkdir /myfolder: OK
Remote directory is now /myfolder
New local directory is C:\Users\myuser\Downloads\SFTP
local: unable to open C:\Users\myuser\Downloads\SFTP\*.*
Can you please suggest what is wrong with my code?

put does not support wildcards, you have to use mput:
lcd "C:\Users\myuser\Downloads\SFTP"
mput *.*

Related

Wget - How do I download some files from ftp server?

I am trying to download some files from a directory in ftp server. I would like to use "wget" command, but I can't get them.
ftp server URL: ftp://192.168.0.10
ftp user name: GL840
ftp password: no password
folder name in ftp: SD1/181004/
I am using the following command to download all files in the folder SD1/181004 in ftp server.
command is "wget -r -nd ftp://GL840:#192.168.0.10/SD1/181004/ -P /root/wang/powerdata/"
However, the following message is displayed and files are not downloaded.
Could you please tell me how to modify my command to download files?
I have tried accessing file on ftp server. Usually I follow the following commands and this works for me. You can give a try with this command
wget --user='GL840' --password='' ftp://192.168.0.10/SD1/181004/

PSFTP - File Transfer Not Happening

I want a file to transfer automatically for one server to another server. For that i have installed putty.
Batch File: Transfer.Bat
cd "C:\Program Files\PuTTY"
psftp Username#RemoteServer.com -pw password -b MovementFileTransferScript.txt -be
Text File: MovementFileTransferScript.txt
open RemoteServer.com
put D:/Backup/FULL_DB_BACKUP-DontDelete.txt R:\DB\Backup
quit
In the above text file, D:/ belongs to Source Server and R:/ belongs to destination server.
When i am running the batch file i am getting the below error.
Using username "Username".
Remote working directory is /
psftp: already connected
local: unable to open D:/Backup/FULL_DB_BACKUP-DontDelete.txt
I have checked the permissions of the folders and everything looks good. Can some one let me know what was the issue here.?

Upload sites files and folders via ftp bash

I need a script to upload files of sites with directories to hosting via ftp.
I try to create a script, but it doesn't work. NO files are on the server. Can you help me, please?
My script
#!/bin/bash
HOST='ip_address'
USER='user'
PASSWD='password'
SERVER_FOLDER='/site'
cd /local_folder_with_sites_files
ftp -in <<END_SCRIPT
open $HOST
user $USER $PASSWD
cd $SERVER_FOLDER
mput -r *
close
bye
END_SCRIPT
echo "Upload complete"
exit 0
Output:
directory: not a plain file.
Permission denied.
Passive mode refused.
OS: Ubuntu 16.04 Panel: VestaCP
But when i upload files via filezilla, uploads is complete.
If anybody has a script which uploads files and folders via ftp, please, show me for example.

How to copy a file from Unix AIX server to nas drive on windows server?

The is nas drive created on window server and it is named as: nas1234dc.
The is a folder under \nas1234dc\data\sourcefile. To access this sourcefile, my user need to be added to a group and that group is having access to this directory. I have username and password of the same.
Now I am on Unix AIX server and trying to connect to nas drive which is on windows as below:
set -x;
HOST='nas1234dc'
USER='winuser'
PASSWD='winpwd'
ftp -i -n $HOST <<EOF
user ${USER} ${PASSWD}
binary
cd C:\
put testing.txt
quit
EOF
Response while running this script is: ftp: connect: Connection refused
Could any one of us help me whether I am in correct root to copy the file to nas drive? Do I have any other best option to copy it securely?
Thanks,
Venkat

putty psftp " and ; in password

I am trying to create a vbscript to connect to a FTP server using putty. The problem I am having is the password has a ; and " in it. I have tried putting the password in " and also using \ to escape the charters
e.g.
-pw 3this;IsMyPwd" is what i want to use
Tried
"3this;IsMyPwd""" -> putty does not connect to remote server
-pw 3this;IsMyPwd""" -> putty does not connect to remote server
3this\;IsMyPwd\" -> putty does not connect to remote server
3this;IsMyPwd\" -> putty does connect to remote server but asks for a password or just hangs
-pw 3this;IsMyPwd"" > putty does connect to remote server but asks for a password or just hangs
The answer is to not use putty. I used WinSCP. You do not have to install it on the server you can copy WinSCP.com and WinSCP.exe to a folder.
Create a file with the commands, note that %22 url encoding of "
example of Cmd.txt file
# Automatically abort script on errors
option batch abort
# Disable overwrite confirmations that conflict with the previous
option confirm off
# Connect
open sftp://USERNAME:password%3%22#ftp.server.org
ls
cd to_folder
ls
close
exit
Run the command C:\winScp> winscp.com /script=Cmd.txt

Resources