Script for put command with file extension

Advertisement

drlachlansmith
Joined:
Posts:
3
Location:
NSW

Script for put command with file extension

Hi, I try to use the put command to specific file extension (*.zip), it never work. Can you help with that please (the script as below)?
put   "C:\Users\Lachlan Smith\Desktop\syntest home"   "/syn2 soure "

Reply with quote

Advertisement

martin
Site Admin
martin avatar
Joined:
Posts:
41,453
Location:
Prague, Czechia

Re: Script for put command with file extension

So what did you try? What is "/syn2 soure "?
The code should be as simple as:
put   "C:\Users\Lachlan Smith\Desktop\syntest home\*.zip" "/target/path/"

Reply with quote

drlachlansmith
Joined:
Posts:
3
Location:
NSW

*.zip not working

Hi, Thanks very much for the reply, I tried the *.zip, it did not, did you try that from your side?
(also to delete the file in the source folder) when using the put function, if you can help with that.

Really appreciate

Reply with quote

martin
Site Admin
martin avatar
Joined:
Posts:
41,453
Location:
Prague, Czechia

Re: *.zip not working

Please attach a full session log file showing the problem (using the latest version of WinSCP).

To generate the session log file, use /log=C:\path\to\winscp.log command-line argument. Submit the log with your post as an attachment. Note that passwords and passphrases not stored in the log. You may want to remove other data you consider sensitive though, such as host names, IP addresses, account names or file names (unless they are relevant to the problem). If you do not want to post the log publicly, you can mark the attachment as private.

Reply with quote

drlachlansmith
Joined:
Posts:
3
Location:
NSW

-delete, -latest, and *.extension working now

the code in the script should be in this way:
open ftp://username:password@ip/
 
lcd "C:\local"
cd "\target"
 
put -delete "*.txt"
(you can change the -delete to any others like -latest also change the extension to the file needed)
Thanks

Reply with quote

Advertisement

martin
Site Admin
martin avatar
Joined:
Posts:
41,453
Location:
Prague, Czechia

Re: -delete, -latest, and *.extension working now

That also works, but it is equivalent to:
put -delete "C:\local\*.txt" "/target/"
(as I have suggested above).

Note that the remote path needs to use forward slashes. With your backslash the results are unpredictable.

Reply with quote

Advertisement

You can post new topics in this forum