Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Copy and Rename Range of files

Status
Not open for further replies.

CecilXavier

Technical User
Oct 2, 2007
104
US
I have a directory with files listed by date. Example: dr041110.dbf, dr041110.fpt,dr041210.dbf, dr041210.fpt,dr041310.dbf, dr041310.fpt, etc.
I would like to be able to set to date ranges (lets say for example 03-16-2011 to 03-23-2011) and copy the files listed above to the date range I specify. Example: dr041110.dbf, dr041110.fpt, are copied and renamed to dr031611.dbf, dr031611.fpt and so on.
I can use the same source files over and over. It would be nice to be able to specify the source range, but that can come later. Any ideas or help would be greatly appreciated.
 




Hi,

Check out the Name statement in VB Help.

Skip,

[glasses]Just traded in my old subtlety...
for a NUANCE![tongue]
 
Not only do you want to use the name statement but run a loop using the file system object. From there just use the string manipulation to get rid of your "/" in the file names
 
Like going down the street with one foot in a car and the other on a horse.

Skip the FSO for this, it was never built to perform well. Use Dir$() and Name and be done with it.

Test for the desired extensions and test the name sans extension for your range criteria.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top