Welcome to the VanDyke Software Forums

Join the discussion today!


Go Back   VanDyke Software Forums > Scripting

Reply
 
Thread Tools Rate Thread Display Modes
  #1  
Old 07-26-2020, 03:10 PM
jjacobus jjacobus is offline
Registered User
 
Join Date: Apr 2004
Location: Vernon Hills, IL
Posts: 7
SFXCL and Powershell

Does anyone have any examples of using SFXCL to upload/download/list files with Powershell? I'm having a difficult time figuring out how to pass parameters to the SFXCL command line. In particular I want to get a /LIST of a directory and parse the results to see if a file is present. I'm converting several .BAT files to .PS1
Reply With Quote
  #2  
Old 07-26-2020, 03:51 PM
bgagnon bgagnon is offline
VanDyke Technical Support
 
Join Date: Oct 2008
Posts: 4,395
Hi jjacobus,

The SFXCL command-line syntax should be the same regardless of the calling app.

What is your SFXCL command-line? In what way is it failing?

There's an example of the /LIST task on our website.
__________________
Thanks,
--Brenda

VanDyke Software
Technical Support
support@vandyke.com
(505) 332-5730
Reply With Quote
  #3  
Old 07-27-2020, 08:52 AM
jjacobus jjacobus is offline
Registered User
 
Join Date: Apr 2004
Location: Vernon Hills, IL
Posts: 7
Capturing results

I figured out the SFXCL command line parameter as variables. (The scope on SET-Variable is different) The key pairs work as before. I can see the result of the list in my log file.

Problem I'm having is capturing the results. In the example:
SFXCL /List sftp://user@host/target_folder 2>&1 | Find ": -"

The "2>&1 Find ": -" bit is what I can't replicate. So this is really a Powershell question.
Reply With Quote
  #4  
Old 07-27-2020, 09:16 AM
bgagnon bgagnon is offline
VanDyke Technical Support
 
Join Date: Oct 2008
Posts: 4,395
Hi jjacobus,

I think it's the Find command that might have a replacement in PowerShell.

https://docs.microsoft.com/en-us/pow...w=powershell-7

Sounds like you need to use Select-String instead:
Quote:
The Select-String cmdlet searches for text and text patterns in input strings and files. You can use Select-String similar to grep in UNIX or findstr.exe in Windows.
What are your results with:
SFXCL /List sftp://user@host/target_folder 2>&1 | Select-String -Pattern ": -"
__________________
Thanks,
--Brenda

VanDyke Software
Technical Support
support@vandyke.com
(505) 332-5730
Reply With Quote
Reply

Tags
powershell sfxcl


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -6. The time now is 02:55 PM.