How to change remote file permission via FTPClient - ftp

I need to handle remote file on a ftp server via commons-net-1.4.1.jar,class org.apache.commons.net.ftp.FTPClient.It's seems that no api available to change a file's permission,just like unix shell command chmod.
Anyone know any solution to resolve this issue?

FTP doesn't have a command for such operations, since the operation is platform-specific. If your library supports this, you can try using SITE command and pass the command line as a parameter of SITE command. Some servers support this trick to run shell commands.

Related

Can I execute a remote placed .vbs file using wscript command?

I have tried using the wscript command with local file share and it works perfectly.
Ex: wscript \\192.168.10.1\script\hello.vbs
Is there any way I can run the file from remote HTTP server?
Something like: wscript http://192.168.10.1/script/hello.vbs
TIA
wscript.exe does not support calling VBScripts directly from an URL. Why not use the FTP server?
Why do you want to use the HTTP?
An solution for you could be, if you have it hosted on an NAS, try to open ports so that you can access it from your IP adres.
I could help you with it if you need it, but you need to give some more details about the hardware (NAS/Router)

Download files from Unix server using WinSCP with get command

I have program in Unix that generates files 8 files at 8:30 pm everyday.
I need to download the files into my Windows machine after the files are generated using WinSCP.
I can drag and drop those but its time consuming, I need to automate this process.
I cannot use .Net assembly to download those.
I have tried to use the get command, but its throwing error: Not an SCCS file.
Let me know how can I solve this.
--Thanks
To automate a task using WinSCP, use its scripting interface from a batch file (e.g. download.bat).
I assume you want to use SFTP, as you are connecting to a *nix server.
The simplest download batch file is like:
winscp.com /log=c:\path\to\log\winscp.log /command ^
"open sftp://username:password#example.com/ -hostkey=""xxx""" ^
"get /path/to/file.ext c:\path\to\download\to\" ^
"exit"
Replace the username, password and example.com with the actual connection details. Get the value of -hostkey switch from your GUI session. Use real paths.
Though it's easier to have WinSCP generate the batch file for you.
For details see a guide to automating file transfers from SFTP server using WinSCP.
Once you have the batch file working, schedule the the batch file execution using Windows scheduler.
See a guide to scheduling file transfers from SFTP server.

Daily upload of file automation using batch script and WinSCP

So I do have a file that I generate weekly from a server using crontab in Linux side and transfer it to my PC. However, I am having a problem when try to send the file that I generate from a different server on Windows side using task scheduler.
Your command-line syntax is wrong.
I'm assuming the \ftpBinverlog_%yyyy%-%mm%-%dd%.txt is the file, you want to download.
It won't work, if you just specify it on command-line like you did.
Also neither Windows scheduler, nor command-interpreter, nor WinSCP understand syntax like %yyyy%.
The path to the remote file does not look good either. *nix systems use forward slashes, not backslashes.
So just keep your /script and /log arguments:
/script=C:\batchrun\Binver\script.tmp /log="C:\BIN VERIFICATION\ftplog"
And make sure the script.tmp looks like:
open sftp://user#example.com
get /ftpBinverlog_%TIMESTAMP#yyyy-mm-dd%.txt C:\target_path\
exit
References:
Guide to automating file transfer from SFTP server
%TIMESTAMP syntax.
Develop a batch file which will download/upload the required file using the SCP command
check this for more details.
check this for more details about the scp command parameters.
Make sure that you are able to run the batch with a successful result, then configure it within a scheduled task.
I hope this could help.

Change ftp folder permission via command line

I'm using windows command line MS FTP for ftp access. However I furthermore must change folder permission via command line as well. I tried CACLS command, alas that doesn't work in open ftp commmand window. Any hint's appreciated
You should be able to change permissions if you use a good GUI client.
Give the following a try and let us know if it works for you!
Filezilla
FTP Commander
FTP is an Internet standard designed by people who work together to a common goal. CACLS is a pile of Microsoft-invented stuff that FTP knows nothing about so that is not going to work unless someone implements a QUOTE command to pass it through. The nearest you can get to changing permissions is with the CHMOD command.

Run a script in remote UNIX using windows command prompt

I currently connect to my UNIX installed on my remote server using Secure CRT. I have a script(sh) on my UNIX which generates a file. I need to su(switch user) before executing the script.
I then ftp to this server(using ftp commands in command prompt on windows) and get the file generated by the above shell script.
However, I would like to automate this process and create a windows .bat file which would connect me to the UNIX server, su and run the required shell script and fetch the file.
I have found that I cannot run the shell script on UNIX using ftp. Could you please suggest me alternate ways to automate this?
Thanks
Thanks for your help guys :) I created a script on secure CRT and while running the application using the bat file, I'm calling this script using the CRT command line options

Resources