- May 31, 2004
- 3,147
- 96
- 91
Hey all, quick question:
I'm trying to write a batch file to get an automated method to upload some ftp files. We need to put these files into a subfolder daily (with the date as the name of the subfolder). I was thinking that they were always going to use todays date as the folder name, which I figured out no problem.
However, now my users are saying that they want to have it reference the file name in case they don't get to it at night :\.
So for example, they have a collection of files that may look like something like this (using dummy words instead of a real file example):
Bob_Is_a_Real_Life_Person_05-02-2011.txt
In this case I would want to create a directory called 05-02-2011 (or even better would be 20110502) and put any text files related to it in that directory (note, all of the files would start with Bob, so I was planning on just doing copy bob*.txt into 20110502\bob*.txt using a for loop).
The characters leading up to the 05-02-2011.txt part can be any number of characters, so I can't really go by that (thats how I did the date one). Is there a function in the command line to look at a certain character (maybe a -) and go back 2 spaces to parse from there, or something like that?
Sorry if its a little confusing, if you need me to clarify lemme know!
Thanks AT! Learning this stuff is awesome, but I'm a little stumped on how to do this one.
I'm trying to write a batch file to get an automated method to upload some ftp files. We need to put these files into a subfolder daily (with the date as the name of the subfolder). I was thinking that they were always going to use todays date as the folder name, which I figured out no problem.
However, now my users are saying that they want to have it reference the file name in case they don't get to it at night :\.
So for example, they have a collection of files that may look like something like this (using dummy words instead of a real file example):
Bob_Is_a_Real_Life_Person_05-02-2011.txt
In this case I would want to create a directory called 05-02-2011 (or even better would be 20110502) and put any text files related to it in that directory (note, all of the files would start with Bob, so I was planning on just doing copy bob*.txt into 20110502\bob*.txt using a for loop).
The characters leading up to the 05-02-2011.txt part can be any number of characters, so I can't really go by that (thats how I did the date one). Is there a function in the command line to look at a certain character (maybe a -) and go back 2 spaces to parse from there, or something like that?
Sorry if its a little confusing, if you need me to clarify lemme know!
Thanks AT! Learning this stuff is awesome, but I'm a little stumped on how to do this one.