Differences

This shows you the differences between the selected revisions of the page.

2023-01-20 2023-01-24
troubleshooting#scripting (martin) source and destination inputs (martin)
Line 21: Line 21:
  * Common mistake is using paths that are relative to the home folder as absolute paths. For example, when there's ''data'' folder in your ''/home/user'' folder, you cannot refer to the folder as ''/data''. Either use an absolute path ''/home/user/data'' (recommended) or relative path ''data''.   * Common mistake is using paths that are relative to the home folder as absolute paths. For example, when there's ''data'' folder in your ''/home/user'' folder, you cannot refer to the folder as ''/data''. Either use an absolute path ''/home/user/data'' (recommended) or relative path ''data''.
  * Remote paths are case sensitive. So ''Data'' is not the same as ''data''.   * Remote paths are case sensitive. So ''Data'' is not the same as ''data''.
 +
 +==== [[inputs]] Source and Destination Inputs ====
 +
 +Commands in scripting (like [[scriptcommand_put|''put'']] and [[scriptcommand_get|''get'']]) and some methods in .NET assembly (like [[library_session_getfiles|''Session.GetFiles'']] and [[library_session_putfiles|''Session.PutFiles'']]) do not take mere paths as inputs. The source input is expected to be a path terminated by a slash (a backslash when uploading) and followed by a [[file_mask|file mask]]. Similarly the destination input is expected to be a path also terminated by a slash (a backslash when downloading) followed by an optional [[operation_mask|operation mask]]. As a simple example, a command to upload all files in scripting should be like:
 +<code winscp>
 +put C:\source\path\* /destination/path/
 +</code>
 +Similarly in .NET assembly:
 +<code csharp>
 +$session.PutFiles("C:\source\path\*", "/destination/path/").Check()
 +</code>
 +The trailing ''\*'' in the source path and the ''/'' in the destination path both matter. Read documentation of respective scripting commands or .NET assembly methods for details. In .NET assembly, in many cases, it's easier to use more specific methods like [[library_session_putfiletodirectory|''Session.PutFileToDirectory'']], [[library_session_putfilestodirectory|''Session.PutFilesToDirectory'']],[[library_session_getfiletodirectory|''Session.GetFileToDirectory'']] or [[library_session_getfilestodirectory|''Session.GetFilesToDirectory'']], as they do not have that strict interpretation of the inputs.
===== Logging ===== ===== Logging =====

Last modified: by martin