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 Andrzejek on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

VB scripts to archive mutliple files with date

Status
Not open for further replies.

fredong

IS-IT--Management
Sep 19, 2001
332
US
Hi,
I am using VB script for Active X DTS. I have mulitple files like (AA.txt, BB.txt. CC.txt) in a directory \\servername\Data and I need to archive it to the directory \\servername\Data\Archive once it is exported through DTS. I like to archive it and add latest date after the original names for example like (AA_20070516.txt, BB_20070516.txt. CC_20070516.txt). Any ideas? Thanks.
 
This is a very common question. Do a search in this forum for "format date" and you'll find plenty of posts regarding similar things.

here is one:
--------------------------------------------------------------------------------
dm4ever
My philosophy: K.I.S.S - Keep It Simple Stupid
 
I think I did not make self clear. In the \\servername\Data directory there are many different formats of files and I only want to archive the .txt files and add the dates to the end of each file. Is that possible? Thanks.
 
You will want to look at the FileSystemObject object to recurse through your folders and look a the files.


You should be able to find examples of this since it is a frequent type of question. In particular you want to look at the GetFolder method which will let you look at the files in that folder.

Once you have your recursion going, then you want to look at the names to see if they have the .txt extension.

The following post shows several files and folder examples...one comparing a datecreated...you should be able to modify to look at the extension.

Again, search and you'll find similar things here.

--------------------------------------------------------------------------------
dm4ever
My philosophy: K.I.S.S - Keep It Simple Stupid
 
Nice find sparkbyte...shows using FSO and WMI [thumbsup2]

--------------------------------------------------------------------------------
dm4ever
My philosophy: K.I.S.S - Keep It Simple Stupid
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top