Excluding Sub Directories from a PUT script

Advertisement

gsgnrant
Guest

Excluding Sub Directories from a PUT script

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

Thanks
Scott

Reply with quote

Advertisement

martin
Site Admin
martin avatar
Joined:
Posts:
40,552
Location:
Prague, Czechia

Re: Excluding Sub Directories from a PUT script

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.

Reply with quote

Advertisement

You can post new topics in this forum