Topic "Excluding Sub Directories from a PUT script"

Author Message


Good afternoon,

Thanks for all the wonderful info already in this forum. I am new to scripting and have found it to be a wealth of knowledge. I have been banging my head to get this simple script working, pretty sure I am not using the syntax correct. I would like to capture all text files 1 day or less in age beginning with EDI in a local directory and upload them to a remote directory. The issue is I can get the put command to ignore all sub directories of the local source and I don't have create privileges on the remote FTP. Here is what I have working fine for a similar directory that does not have any sub directories. This is the working script for the folder without sub directories (I am capturing .dat files in this one

put -nopermissions -nopreservetime -filemask="EDI*.dat>=1D" \\LOCAL_DIRECTORY /REMOTE_DIRECTORY

I have tried the following for the folder whose sub-directories need to be ignored

put -nopermissions -nopreservetime -filemask="EDI*.txt>=1D| */" \\LOCAL_DIRECTORY /REMOTE_DIRECTORY
put -nopermissions -nopreservetime -filemask=""EDI*.txt>=1D| */"" \\LOCAL_DIRECTORY /REMOTE_DIRECTORY

[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 25966
Location: Prague, Czechia
This looks good:
gsgnrant wrote:
put -nopermissions -nopreservetime -filemask="EDI*.txt>=1D| */" \\LOCAL_DIRECTORY /REMOTE_DIRECTORY

Just make sure both the \\LOCAL_DIRECTORY and the /REMOTE_DIRECTORY are terminated with (back)slashes.

If it does not work, please attach a full session log file showing the problem (using the latest version of WinSCP).

To generate the session log file, enable logging, log in to your server and do the operation and only the operation that causes the error. Submit the log with your post as an attachment. Note that passwords and passphrases not stored in the log. You may want to remove other data you consider sensitive though, such as host names, IP addresses, account names or file names (unless they are relevant to the problem). If you do not want to post the log publicly, you can mark the attachment as private.

You can post new topics in this forum

Search Site

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!


About donations

$9   $19   $49   $99

About donations


WinSCP Privacy Policy

WinSCP License