Fixed days.  Exactly 45 days ago.
This is looking good.
Thanks

From: [email protected] [mailto:[email protected]] On 
Behalf Of Ken Schaefer
Sent: Tuesday, June 03, 2014 8:10 AM
To: [email protected]
Subject: [NTSysADM] RE: copy files to folders

' Fixed the .CopyFile call

' Subtract 45 days from Today
dTheDate = DateAdd("d", -45, Date())

' Look for Filename
sFileName = Month(dTheDate) & Day(dTheDate) & Year(dTheDate()) & ".7z"

' Set Source and Destination Directories
sSrcDir = "c:\myFiles"
sDstDir = "c:\" & MonthName(Month(dTheDate), True) & Year(dTheDate)  ' 
MonthName optional parameter provides 3 letter abbreviation of Month

' Copy File
Set oFS = CreateObject("Scripting.FileSystemObject")
oFS.CopyFile sSrcDir & "\" & sFileName, sDstDir
Set oFS = Nothing



From: [email protected]<mailto:[email protected]> 
[mailto:[email protected]] On Behalf Of Ken Schaefer
Sent: Tuesday, 3 June 2014 10:03 PM
To: [email protected]<mailto:[email protected]>
Subject: [NTSysADM] RE: copy files to folders

Any objection to VBScript? Not sure what the two parameters are that you need 
to supply, since it seems that the values are fixed (today - 45 days). Or are 
you saying that you could have files generated with arbitrary dates today, and 
you only want to move the ones that have dates older than 45 days prior to 
today moved?


' Subtract 45 days from Today
dTheDate = DateAdd("d", -45, Date())

' Look for Filename
sFileName = Month(dTheDate) & Day(dTheDate) & Year(dTheDate()) & ".7z"

' Set Source and Destination Directories
sSrcDir = "c:\myFiles"
sDstDir = "c:\" & MonthName(Month(dTheDate), True) & Year(dTheDate)  ' 
MonthName optional parameter provides 3 letter abbreviation of Month

' Copy File
Set oFS = CreateObject("Scripting.FileSystemObject")
oFS.CopyFile sFileName, "c:\tempfolder\"
Set oFS = Nothing


From: [email protected]<mailto:[email protected]> 
[mailto:[email protected]] On Behalf Of David McSpadden
Sent: Tuesday, 3 June 2014 9:14 PM
To: '[email protected]'
Subject: [NTSysADM] copy files to folders

I would like on a Server 2012 box to run a powershell or dos batch that will do 
the following:
Copy file x to folder y. Where file x is passed as parm %1 and folder y as parm 
%2.
These are all date files and month/year folders.
For example file 041014.7z is moved to folder Apr 2014 in the same parent 
folder and file
050114.7z is moved to folder May 2014.
This is a daily job that would be running 45 days in the past.
So today 06/03/2014 the job would be looking at 04/19/2014.
I think I want a standard batch/powershell that looks at the first 2 and 5-6 
char of filename and
Moves that file to the mmm yyyy folder that equates.
So in the batch file there will be a for, if or do/while case going on. Not 
sure about the powershell?

Any words of wisdom?  Either way is acceptable.  Just lack the brainpower to 
get it done this morning.



This e-mail and any files transmitted with it are property of Indiana Members 
Credit Union, are confidential, and are intended solely for the use of the 
individual or entity to whom this e-mail is addressed. If you are not one of 
the named recipient(s) or otherwise have reason to believe that you have 
received this message in error, please notify the sender and delete this 
message immediately from your computer. Any other use, retention, 
dissemination, forwarding, printing, or copying of this email is strictly 
prohibited.

Please consider the environment before printing this email.

Reply via email to