There's no such thing as a stupid question, but they're the easiest to answer.
JoinTour
Login
 
Software Development
Tag Cloud
audio blue screen boot bsod computer cpu crash dell desktop driver drivers error excel external hard drive firefox freezes freezing hard drive hardware hijackthis internet internet explorer itunes laptop mac malware motherboard mouse network networking outlook 2007 power printer problem ram restart router screen slow sound trojan usb virus vista vista 32-bit windows windows xp winxp wireless wmp
Search
Search in:
 
Advanced Search
Tech Support Guy Forums > Software & Hardware > Software Development >
Date for batch file


Computer problem? Tech Support Guy is completely free -- paid for by advertisers and donations. Click here to join today! If you're new to Tech Support Guy, we highly recommend that you visit our Guide for New Members. Enjoy!

Closed Thread
 
Thread Tools
KellyLeia's Avatar
Junior Member with 2 posts.
 
Join Date: Jun 2004
08-Jun-2004, 10:55 AM #1
Date for batch file
I need to know how to create a batch file that will post to an ftp by looking for a file with a specified date. It's a two step process. First, a batch file is run to encrypt, and the output file is KML_06082004.pgp. Then another batch file needs to be run to post a file to a client's ftp site. Currently, what I'm doing is going into the second batch file that posts the file and changing the date every week to the current date in the mmddyyyy format. I've been looking online for a way to run it so I don't have to change the date every week, but all I keep finding is how to encrypt a file with the date as part of the name, and I already know how to do this. This is the code that encrypts the file

Note...Actual names have been changed to protect the innocent.
--------------------------------------------
echo off
set year=%date:~10,4%
set month=%date:~4,2%
set day=%date:~7,2%
set newdate=%month%%day%%year%
echo %newdate%

Pause

C:
cd gnupg
gpg -o C:\KML_%newdate%.pgp -r xxxxxxxx -e C:\KML.txt
------------------------------------------------------------

This is the file that sends it out...(minus the username and password of course)
------------------------------------------------------
open ftp.myftp.com
lcd C:\
binary
put KML_06082004.pgp
quit
-----------------------------------------------

Anyone got any solutions or a link that can help me out? It's not like this is killling me doing this, it's just annoying having to change this every week.
MustBNuts's Avatar
Distinguished Member with 2,017 posts.
 
Join Date: Aug 2003
Location: Nevada
09-Jun-2004, 08:59 PM #2
Okay, just a thought here (and let me warn you, my DOS is a bit rusty...):

Add a couple of lines to your batch file that instruct it to move the file to a \sent subdirectory when the process is complete (or use copy then delete the file from the original subdirectory). The only file that will ever be in the root directory will be the current one to be sent, so use a wildcard to pick it out and send it (I also believe in putting this stuff in a subdirectory, not directly into root C) :

-----------------------
open ftp.myftp.com
lcd C:\
binary
put KML_*.pgp
move c:\KML_*.pgp c:\ftpSent\*.*
quit
----------------------------------

Let me know if this works,

MBN
__________________
I'll burn that bridge when I get to it!
KellyLeia's Avatar
Junior Member with 2 posts.
 
Join Date: Jun 2004
15-Jun-2004, 11:45 AM #3
On the batch file, i changed put KML_06082004.pgp to put KML_*.pgp. It worked fine as far as I can tell. I knew that you could use the * as the wildcard, but I didn't think you could do it in the middle of a file name. Thanks for the help!

Kelly
Closed Thread

THIS THREAD HAS EXPIRED.
Are you having the same problem? We have volunteers ready to answer your question, but first you'll have to join for free. Need help getting started? Check out our Welcome Guide.


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
WELCOME TO TECH SUPPORT GUY! Are you looking for the solution to your computer problem? Join our site today to ask your question -- for free! Our site is run completely by volunteers who want to help you solve your computer problems. See our Welcome Guide to get started.



Thread Tools


You Are Using:
Server ID
Advertisements do not imply our endorsement of that product or service.
All times are GMT -4. The time now is 09:48 AM.
Copyright © 1996 - 2008 TechGuy, Inc. All rights reserved.
Powered by vBulletin, Copyright © 2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0
Powered by Cermak Technologies, Inc.