Link to home
Start Free TrialLog in
Avatar of PetEdge
PetEdgeFlag for Afghanistan

asked on

NCFTPPUT - FTP script to copy dynamic file names

Hello,

I have a daily process which copies files to our FTP server.  From there, the files should be FTP'd to another server.  

Typically, I'll use syntax like the following:

ncftpput -f c:\scripts\loginCredentials.txt RemoteFolder \ "c:\transfer\out\fileToBeCopied.txt"

That's fine if the file name does not change.  In this case, I'd like to either rename the file to include a date time stamp OR copy a file which has this already in it's name.  

Directory:  c:\transfer\out\
fileToBeCopied20150120_0929.txt
fileToBeCopied20150119_0929.txt
fileToBeCopied20150118_0929.txt


In this case, I can't seem to get the ncftpput to work with a wild card - i.e., the file variable name.

Thanks in advance for the help.

Karen
ASKER CERTIFIED SOLUTION
Avatar of Gary Patterson, CISSP
Gary Patterson, CISSP
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of PetEdge

ASKER

Gary,

Either solution is acceptable.  Your first solution with the wildcard worked beautifully; my script had been failing due to the quotes.  

Fails:
ncftpput -f c:\scripts\loginCredentials.txt RemoteFolder \ "c:\transfer\out\fileToBeCopied*.txt"

Works:
ncftpput -f c:\scripts\loginCredentials.txt RemoteFolder \ "c:\transfer\out\fileToBeCopied*.txt"

Thanks!!

Karen
Avatar of PetEdge

ASKER

Quick and thorough answer - very much appreciated.
Educated guess.  Glad it worked.