NCFTPPUT - FTP script to copy dynamic file names

Posted on 2015-01-20
Last Modified: 2015-01-20

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\

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.

Question by:PetEdge
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
LVL 35

Accepted Solution

Gary Patterson earned 500 total points
ID: 40560079
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

Author Comment

ID: 40560211

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

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

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



Author Closing Comment

ID: 40560212
Quick and thorough answer - very much appreciated.
LVL 35

Expert Comment

by:Gary Patterson
ID: 40560327
Educated guess.  Glad it worked.

Featured Post

Best Practices: Disaster Recovery Testing

Besides backup, any IT division should have a disaster recovery plan. You will find a few tips below relating to the development of such a plan and to what issues one should pay special attention in the course of backup planning.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
How can i echo a ! to end of a file? 8 36
Moving a windows 7 install to new hardware 9 182
Upgrade dos 4.00.1111 11 69
Convert (short) Powershell script to VBS 8 56
YESTERDAY YESTERDAY.BAT is inspired by a previous article I wrote entitled: TOMORROW.BAT ( The crux of this batch f…
Many people tend to confuse the function of a virus with the one of adware, this misunderstanding of the basic of what each software is and how it operates causes users and organizations to take the wrong security measures that would protect them ag…
This is used to tweak the memory usage for your computer, it is used for servers more so than workstations but just be careful editing registry settings as it may cause irreversible results. I hold no responsibility for anything you do to the regist…
Hi friends,  in this video  I'll show you how new windows 10 user can learn the using of windows 10. Thank you.

752 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