Topic "Shouldn't the .FileExists() method support wildcards?"

Author Message
dotps1
[View user's profile]
Contributor
Joined: 2015-03-23
Posts: 18
Location: United States
Shouldn't the .FileExists() method on the Session object support wildcards?

Similar to in powershell to like

PS C:\> Test-Path C:\Wind*
True

Its difficult to test if a wildcard is used, you'd have to test if a wildcard is in the string, then parse the directory from the path, the enumerate, then see if its greater then 1, i guess.
_________________
https://github.com/dotps1
martin◆
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 27058
Location: Prague, Czechia
The FileExists method was not intended to support wildcards.

You can easily implement wildcard testing using Session.EnumerateRemoteFiles:
https://winscp.net/eng/docs/library_session_enumerateremotefiles
dotps1
[View user's profile]
Contributor
Joined: 2015-03-23
Posts: 18
Location: United States
i definitely get i could do it with that enumeration method, i just me logically if there is a file called "test.txt" then $session.FileExists(./test*) should be true, because that file "does" exist.
_________________
https://github.com/dotps1
Advertisements

You can post new topics in this forum

Search

What is WinSCP?

It is award-winning SFTP client, SCP client, FTPS client and FTP client integrated into one software program for file transfer to FTP server or secure SFTP server. [More]

And it's free!

Donate

About donations

$9   $19   $49   $99

About donations

Recommend

WinSCP Privacy Policy

WinSCP License