![]() |
![]() |
| Home | What's New | Products | Download | Purchase | Support | About Us | Contact |
SUPPORT > TIPS
|
|
|
|
Using SFXCL /List Workaround to Check for Remote FilesIn some file transfer scenarios, you might need to know if a particular file or subset of files exists on a remote server. SecureFX's SFXCL command-line utility can provide a complete file listing of a specified folder on a remote system. However, what if you are only interested in knowing if a specific file exists, and you don't want to manually search the results looking for a proverbial needle in a haystack of files and folders? While SFXCL's /List functionality supports specifying a remote folder path, it doesn't currently support specifying file names, wildcards, or other patterns for filtering output. As a workaround, however, you can use the Find CMD utility to help narrow the results of SFXCL's /List output. SFXCL's /List functionality returns a list of all files, folders and links that exist in the specified folder on a remote machine. For example: C:/>SFXCL /List sftp://user:pass@host/target_folder 2012-02-01 09:14:30, 00001: drwxr-x--- 8192 Wed 30-Nov-2011 10:25:03 . (S) The Find CMD utility can be used to exclude directories and links by filtering out all lines that don't match the pattern ": -" (the first permissions field in a long UNIX file listing displays a regular file as "-"). The following example takes the output of the SFXCL /List command and pipes the results to the Find CMD utility which filters out everything except the regular files: C:\>SFXCL /List sftp://user@host/target_folder 2>&1 | Find ": -" 2012-02-01 09:16:38, 00001: -rw-r--r-- 540 Fri 26-Aug-2011 14:04:41 .bash_profile (S) Then you can pipe the output of the first Find command to a second instance of the Find command so as to narrow the output further. For example, to display just those files that end in ".log", you would use the following command: SFXCL /List sftp://user@host/target_folder 2>&1 | Find ": -" | Find ".log " The Find command returns success if the given pattern matches anything in the input (as indicated when the %ERRORLEVEL% CMD environment variable has a value of zero). For example: C:/>SFXCL /List sftp://user@host/target_folder 2>&1 | Find ": -" | Find ".log " 2011-03-01 15:51:30, 00001: -rw-r--r-- 13814 Wed 07-May-2003 07:25:01 session.log (S) C:\>echo %ERRORLEVEL% If the Find command does not match the given pattern in the input, a non-success (non-zero) value is returned. For example: C:/>SFXCL /List sftp://user@host/target_folder 2>&1 | Find ": -" | Find ".png" C:\>echo %ERRORLEVEL% For additional information on using the SFXCL command-line utility, see the SecureFX Help files.
|
|||||||||
| Products | Downloads | Purchase | Support | About Us | |
|---|---|---|---|---|---|
| VShell Server | VShell Server | Buy Direct | Evaluation | Contact | |
| SecureCRT | SecureCRT | License Pricing | Updates Policy | Press Releases | |
| SecureFX | SecureFX | About Encryption Export | FAQs | What's New | |
| VanDyke ClientPack | VanDyke ClientPack | Orders FAQ | Tips & How-Tos | Customer Stories | |
| Beta Software | Beta Software | Resellers | Forums | Secure Solutions | |
|
Site Map | Legal Notices | Privacy Policy | Refund Policy VShell, SecureCRT, SecureFX, Entunnel, CRT, and AbsoluteFTP are trademarks or registered trademarks of VanDyke Software, Inc. in the United States and/or other countries. All other trademarks or registered trademarks are the property of their respective owners. Copyright © 1995 - VanDyke Software, Inc. All rights reserved. |
|||||