Solved

NCFTPPUT - FTP script to copy dynamic file names

Posted on 2015-01-20
4
638 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 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
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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Being a system administrator some time we require to do things remotely, one of them is installing software. Here I am going to tell you how to install software through wmic (Windows management instrument console). I am not at all saying that this i…
I don't know if many of you have made the great mistake of using the Cisco Thin Client model with the management software VXC. If you have then you are probably more then familiar with the incredibly clunky interface, the numerous work arounds, and …
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.

635 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