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 Structure
C:\Confidential
Under this Parent folders are 2 Sub folders
C:\Confidential\ABC-11
Prod_Oct_03_2011
Oct_03_2011
C:\Confidential\ABC-22
Prod_Oct_03_2011
Oct_03_2011
There 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.txt
This file resides on all the 4 folders to be copied
ABC-11\Prod_Oct_03_2011 and Oct_03_2011
ABC-22\Prod_Oct_03_2011 and Oct_03_2011
The 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 date
2.) 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
Page 1 of 1
Copy File and Rename and more Need your help building a Script
#2
Posted 06 October 2011 - 02:01 AM
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_Year
you can do it with VBS scripting.
Example Code Below Produces Month_Date_Year
Dim Dt :Dt = Day(Date)
If Len(Dt) = 1 Then Dt = "0" & Dt
WScript.Echo MonthName(Month(Date),True) & "_" & _
Dt & "_" & Year(Date)
#3
Posted 12 October 2011 - 02:20 AM
@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.
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.
#4
Posted 12 October 2011 - 11:54 AM
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
- ← CMD: Delete Empty Line
- Programming (C++, Delphi, VB/VBS, CMD/batch, etc.)
- Inno Setup does not delete previous database →
Share this topic:
Page 1 of 1



Help
Back to top









