Solved

NCFTPPUT - FTP script to copy dynamic file names

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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

As the title indicates, I have done this before. It chills me everytime I update the OS on my phone, (http://www.experts-exchange.com/articles/18084/Upgrading-to-Android-5-0-Lollipop.html) because one time I did this and I essentially had a bricked …
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…
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.

821 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