Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

NCFTPPUT - FTP script to copy dynamic file names

Posted on 2015-01-20
4
Medium Priority
?
677 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
[X]
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
4 Comments
 
LVL 35

Accepted Solution

by:
Gary Patterson earned 2000 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
0
 

Author Comment

by:PetEdge
ID: 40560211
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
ID: 40560212
Quick and thorough answer - very much appreciated.
0
 
LVL 35

Expert Comment

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

Featured Post

Free Backup Tool for VMware and Hyper-V

Restore full virtual machine or individual guest files from 19 common file systems directly from the backup file. Schedule VM backups with PowerShell scripts. Set desired time, lean back and let the script to notify you via email upon completion.  

Question has a verified solution.

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

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…
This article provides a convenient collection of links to Microsoft provided Security Patches for operating systems that have reached their End of Life support cycle. Included operating systems covered by this article are Windows XP,  Windows Server…
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.

722 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