Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
I have .csv files with timestamps in a folder like: 17068679.CSV, 17068678.CSV, 17068668.CSV, 16068679.CSV, 16068678.CSV etc.
I need to know how many lastest files (those files have same timestamp like "17068") in the folder then I can upload them to my ftp server. Any1 can help?
ty before

Didn't we go through this a couple days ago?
=====================================
If at first you don't succeed, you're about average.M2

How does 17068 translate to the actual day? Do you have the algorithm that gives you this number, given a day, month and year?

Use the %DATE% variable to get today's date. On my system, %DATE% is formatted as dd/mm/yyyy. On yours, it may be a different format, so you'll have to adjust the code below accordingly.
set dd=%date:~0,2%
set mm=%date:~3,2%
set y=%date:~9,1%
set filespec=%dd%%mm%%y%*.csv
copy %filespec% ..\other_folder

http://www.computing.net/answers/pr...
We been through all this.
=====================================
If at first you don't succeed, you're about average.M2

@Mechanix2Go yes, i know but my Pro wasnt solved in this topic
ty klint ur script worked well but can u check my script below why it only uploads 1 file to my ftp serverset mm=%date:~4,2%
set dd=%date:~7,2%
set y=%date:~13,1%
set filespec=%dd%%mm%%y%*.csv@echo off
echo user myysername> ftpcmd.dat
echo mypassword>> ftpcmd.dat
echo bin>> ftpcmd.dat
echo put c:\csv\%filespec%>> ftpcmd.dat
echo quit>> ftpcmd.dat
ftp -n -s:ftpcmd.dat myftpserver
del ftpcmd.dat

If you use #8 from the other thread it will copy files to d:\outgoing [modify to suit]
You may want to clear that directoy first.
Then just ftp from there.
I think you'll want MPUT instead of PUT.
=====================================
If at first you don't succeed, you're about average.M2

I don't know why mput doesn't work. You could try the following:
1. Check the generated ftpcmd.dat file contains the correct filespec.
2. Adding a line for debugging purposes, just before the mput command:
!dir c:\csv\%filespec%
This should do a dir listing on the local machine, and it should show all the files you expect to be there.
3. Instead of mput c:\csv\%filespec% try splitting it up into two lines:
lcd C:\csv
mput %filespec%I hope that helps.

![]() |
auto cd
|
Batch file query
|

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.
| Ads by Google |