Differences
This shows you the differences between the selected revisions of the page.
scriptcommand_rm 2012-08-03 | scriptcommand_rm 2020-05-29 (current) | ||
Line 1: | Line 1: | ||
- | ====== rm ====== | + | ====== rm command ====== |
Removes one or more remote files. | Removes one or more remote files. | ||
+ | |||
+ | ===== Syntax ===== | ||
rm <file> [ <file2> ... ] | rm <file> [ <file2> ... ] | ||
- | If [[ui_login_environment#recycle_bin|remote recycle bin]] is configured, moves file to the bin instead of deleting it. Filename can be replaced with [[file_mask|wildcard]] to select multiple files. | + | ===== [[remarks]] Remarks ===== |
- | Can remove non-empty directories recursively. &beta_feature | + | If [[ui_login_recycle_bin|remote recycle bin]] is configured, moves file to the bin instead of deleting it. Filename can be replaced with [[file_mask|wildcard]] to select multiple files. |
+ | |||
+ | Can remove non-empty directories recursively. | ||
+ | |||
+ | Effective [[scriptcommand_option|options]]: ''[[scriptcommand_option#failonnomatch|failonnomatch]]'' | ||
XML log element: ''[[logging_xml#rm|rm]]'' | XML log element: ''[[logging_xml#rm|rm]]'' | ||
Line 13: | Line 19: | ||
<code winscp> | <code winscp> | ||
rm index.html | rm index.html | ||
+ | </code> | ||
+ | <code winscp> | ||
rm index.html about.html | rm index.html about.html | ||
+ | </code> | ||
+ | <code winscp> | ||
rm *.html | rm *.html | ||
</code> | </code> | ||
+ | ===== Converting to .NET Assembly ===== | ||
+ | When [[library_from_script|converting script to .NET Assembly]], map ''rm'' command to ''[[library_session_removefiles|Session.RemoveFiles]]'' method. | ||
+ | Parameters mapping: Command parameter ''file'' maps to method parameter ''path''. When multiple file parameters are used, you need to call ''Session.RemoveFiles'' multiple times. You have to [[library_from_script#paths|convert relative paths to absolute paths]]. | ||
+ | |||
+ | For example, following script snippet: | ||
+ | |||
+ | <code winscp> | ||
+ | cd /home/martinp/public_html | ||
+ | rm index.html about.html | ||
+ | </code> | ||
+ | |||
+ | maps to following [[library_powershell|PowerShell]] code: | ||
+ | |||
+ | <code powershell> | ||
+ | $session.RemoveFiles("/home/martinp/public_html/index.html") | ||
+ | $session.RemoveFiles("/home/martinp/public_html/about.html") | ||
+ | </code> |