tough time with VB Script... would like to help....!!

Author Message
VJ

  • Total Posts : 6
  • Scores: 0
  • Reward points : 0
  • Joined: 11/17/2011
  • Status: offline
tough time with VB Script... would like to help....!! Monday, November 21, 2011 7:10 AM (permalink)
0


I am need of a VB Script...
1. I have folder say - "C:\Users\Name\Desktop\my_file\" have some more folders inside e.g. - AAAA, BBBB, XXXX, YYYY, ZZZZ etc.
2. In folder AAAA there are many files say: app20111212.log, FB20111213.log, FB20111214.txt, app20111212.txt.... etc.
3. I would like to transfer all the files  which has name starting with app* and has extension txt  and are older than 30 days.
4. In new Folder say - "C:\Users\Name\Desktop\my_file\Archive_Log\
5. The files in Folder Archive_Log should be zipped in a single file as AAAA_APP_TXT_20111221.ZIP
6. And the the name of files should be written in new log file in Archive_Log say - AAAA_20111221.log.
7. Any thing in Folder Archive_Log should be deleted if it is older than 30 days.
I would like to use the same script with all the files BBBB, XXXX, YYYYY with different file name & ext. 
Attached is the working working version of your similar script and need some modification.
 
--http://www.code-bytes.com/Automate_WSH_VBScript_To_Delete_Or_Archive_Files.html

thank you...


http://www.code-bytes.com..._Or_Archive_Files.html

 
 
#1
    UnhandledException

    • Total Posts : 1
    • Scores: 0
    • Reward points : 0
    • Joined: 11/22/2011
    • Status: offline
    Re:tough time with VB Script... would like to help....!! Tuesday, November 22, 2011 4:30 AM (permalink)
    0
    Hello VJ,
     
    This section of the script will identify the date of the file, extension and first part off the file name. I am going off memory here so it might not be perfect but it will give you a kick in the right direction :) The rest of what you want to do should be fairly easy, at work we use PKZip, its easy to zip with VBScript and PKZip (use google). Im afraid that I wont write the full script for you as lets be fair, im not going to get paid for it but I certainly dont mind pointing you in the right direction :) As I say, im going off memory here. Might not be 100% but its a step in the right direction.
     
    For Each Subfolder in Folder.SubFolders
    For Each File in SubFolder.Files
    If DateDiff("D", file.DateLastModified, Now) > 30 and Mid(File.Name, 3) = "App" and file.Type = "Text Document" Then
    FileSystemObject.MoveFile File.Path, [String of path and new filename here - This part is upto you]
    End If
    Next
    Next
     
    #2
      59cobalt

      • Total Posts : 981
      • Scores: 91
      • Reward points : 0
      • Joined: 7/17/2011
      • Status: offline
      Re:tough time with VB Script... would like to help....!! Tuesday, November 22, 2011 11:19 AM (permalink)
      0
      UnhandledException
      If DateDiff("D", file.DateLastModified, Now) > 30 and ...
      There's an easier way to the date comparison than DateDiff() if you're counting days:
      If file.DateLastModified < Now - 30 And ...

      <message edited by 59cobalt on Tuesday, November 22, 2011 11:34 AM>
       
      #3

        Online Bookmarks Sharing: Share/Bookmark

        Jump to:

        Current active users

        There are 0 members and 1 guests.

        Icon Legend and Permission

        • New Messages
        • No New Messages
        • Hot Topic w/ New Messages
        • Hot Topic w/o New Messages
        • Locked w/ New Messages
        • Locked w/o New Messages
        • Read Message
        • Post New Thread
        • Reply to message
        • Post New Poll
        • Submit Vote
        • Post reward post
        • Delete my own posts
        • Delete my own threads
        • Rate post

        2000-2012 ASPPlayground.NET Forum Version 3.9