AndrewTrevayne Posted October 6, 2011 Posted October 6, 2011 Hi Everyone,Let me introduce myself, My name is Andrew and I am quite new to this forum.I came to know it while searching for a solution to my project and I hope you guys could help me figure out a way to do it.Here are some of the basic Details:Folder StructureC:\ConfidentialUnder this Parent folders are 2 Sub foldersC:\Confidential\ABC-11Prod_Oct_03_2011Oct_03_2011C:\Confidential\ABC-22Prod_Oct_03_2011Oct_03_2011There are 2 Folder within the Parent Folder Confidential, these folders are ABC-11 and ABC-22.* Inside ABC-11 I need to copy the folders Prod_Oct_03_2011 and folder Oct_03_2011 on the same folder (ABC-11) Except that it will be renamed to the date which I need to Input (some sort of ask date input at the beginning of the Script)* Inside ABC-22 I need to copy the folders Prod_Oct_03_2011 and folder Oct_03_2011 on the same folder (ABC-12) Except that it will be renamed to the date which I need to Input (some sort of ask date input at the beginning of the Script)On top of this I have this text file called EditData.txtThis file resides on all the 4 folders to be copiedABC-11\Prod_Oct_03_2011 and Oct_03_2011ABC-22\Prod_Oct_03_2011 and Oct_03_2011The file EditData.txt contains one line which is the date (On this format ->Oct 03 2011), Which I also need to update to the date that I just inputted.This process is quite complicated and very tedious doing it manually (On a weekly basis).Could you suggest a way to automate it? I was looking at possible doing a VBScript for this but Im a novice when it comes to scripting.I did came across some script below (and edited it) but I dont think it does anything.Dim FSO Set FSO = CreateObject("Scripting.FileSystemObject") FSO.CopyFolder "C:\Confidential\ABC-11", "C:\Confidential"FSO.CopyFolder "C:\Confidential\ABC-22", "C:\Confidential"Set FSO = nothing The Process that I would like to achieve is:1.) I will be prompted to ask for a date2.) Copy the Folders and Rename the Folders (Name will be based on the date I just inputted)3.) The Line on the file EditData.txt will be changed (Line will be based on the date I inputted MMM DD YYYY)Is this possible? Appreciate if you could help me on this little project. Thank you in advance.Cheers,Andrew
gunsmokingman Posted October 6, 2011 Posted October 6, 2011 If you need the user input only to get the date format that you specified you can do it with VBS scripting.Example Code Below Produces Month_Date_YearDim Dt :Dt = Day(Date) If Len(Dt) = 1 Then Dt = "0" & Dt WScript.Echo MonthName(Month(Date),True) & "_" & _ Dt & "_" & Year(Date)
AndrewTrevayne Posted October 12, 2011 Author Posted October 12, 2011 @gunsmokingman Thank you sir. But Im really a noob and not sure how to use the script that you just gave. But again thanks.Any other inputs? Appreciate your help. Thanks.
gunsmokingman Posted October 12, 2011 Posted October 12, 2011 The first code would replace this code to get the date format.Dim Act :Set Act = CreateObject("Wscript.Shell")Dim Info :'-> Loop To Get User Responce Do Until Info > ""'-> User Input Info = InputBox("Type In The Date Format Month/Date/Year" & _ "Or Just Type Exit Or Quit To Do Nothing.") '-> User Cancel If InStr(1,Info,"quit" ,1) Or InStr(1,Info,"exit" ,1) Then Act.Popup "User Cancel Script, Preparing To Close", 4,"User Input",4128 WScript.Quit End If '-> Process User Input If Not Info = "" Then Act.Popup "User Input = " & Info, 4,"User Input",4128 Exit Do End If Loop
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now