View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
stefan via OfficeKB.com stefan via OfficeKB.com is offline
external usenet poster
 
Posts: 18
Default count / move files


Hi,
win XP Excel 2003 + win 2000 Excel 97

I'd like to achieve
1 - check/count files in location 2 based on date (older then today or files
from today)
2 - check/count files in location 3 warn if older then X days based on
todays date
3 - move files from location 2 to location 4 if older then today or files
from todays after the count in step 1
4 - It would be great if the files that are moved to location 4 could create
a folder for the respective month. So, if the file was saved on July 20 2005,
i'd like to have it moved to folder \2005 July\. If that folder does not yet
exist, create the folder. File names remain the same and dont need to change.

Thank you for your help.
Stefan
______________________________

And this where i am now:
Private Sub search()
Dim i As Long
Dim FS As FileSearch
Set FS = Application.FileSearch
Dim Msg, Style, Title, Response, MyString
Msg = "Do you want to run the process now." & (Chr(10))
Style = vbYesNo + vbDefaultButton1
Title = "Process Service Forms Now"
Response = MsgBox(Msg, Style, Title)
If Response = vbYes Then
MyString = "Yes"
'Range("B2:B4").Clear
' ______________________
' Count Not Processed
MsgBox "Counting Not Processed Files"
With FS
.LookIn = "location1\"
'.FileName = "*.xls"
If .Execute(SortBy:=msoSortByFileName, _
SortOrder:=msoSortOrderAscending) 0 Then
Range("B2") = FS.FoundFiles.Count
End If
End With
' ______________________
' Count Pending
MsgBox "Counting Pending Files"
With FS
.LookIn = "location2\"
'.FileName = "*.xls"
If .Execute(SortBy:=msoSortByFileName, _
SortOrder:=msoSortOrderAscending) 0 Then
Range("B3") = FS.FoundFiles.Count
End If
End With
' ______________________
' Count Completed
MsgBox "Counting Completed Files"
With FS
.LookIn = "location3\"
'.FileName = "*.xls"
If .Execute(SortBy:=msoSortByFileName, _
SortOrder:=msoSortOrderAscending) 0 Then
Range("B4") = FS.FoundFiles.Count
End If
End With
' ______________________
' Move / Archive files older then day X (depending on when the count report
is run
' would be last business day (older then today) or today's files
MsgBox "Archiving Files"
' location4
' ______________________
MsgBox "Process Completed"
Else
End If
MsgBox "Process Stopped"
End Sub


--
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...mming/200507/1