Solved

NCFTPPUT - FTP script to copy dynamic file names

Posted on 2015-01-20
4
459 Views
Last Modified: 2015-01-20
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
0
Comment
Question by:PetEdge
  • 2
  • 2
4 Comments
 
LVL 34

Accepted Solution

by:
Gary Patterson earned 500 total points
Comment Utility
Not sure I understand the question.  Do you want to use a wildcard to transfer multiple files?

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

Or do you want to use a variable in a BAT file?

set SOMEDATE=20150120_0929
ncftpput -f c:\scripts\loginCredentials.txt RemoteFolder \ c:\transfer\out\fileToBeCopied%SOMEDATE%.txt

- Gary
0
 

Author Comment

by:PetEdge
Comment Utility
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
0
 

Author Closing Comment

by:PetEdge
Comment Utility
Quick and thorough answer - very much appreciated.
0
 
LVL 34

Expert Comment

by:Gary Patterson
Comment Utility
Educated guess.  Glad it worked.
0

Featured Post

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

Sometimes a user will call me frantically, explaining that something has gone wrong and they have tried everything (read - they have messed it up more and now need someone to clean up) and it still does no good, can I help them?!  Usually the standa…
In a recent article here at Experts Exchange (http://www.experts-exchange.com/articles/18880/PaperPort-14-in-Windows-10-A-First-Look.html), I discussed my nine-month sandbox testing of the Windows 10 Technical Preview, specifically with respect to r…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now