jben Posted April 24, 2008 Share Posted April 24, 2008 One last quickie question. I have folder setup like this FOLDER200814 FOLDER200815 FOLDER200816 FOLDER200817 Is it possible that when FOLDER18 is created next week that folder 14 is removed...The numbers are just Week numbers.. C:\Output\"&@YEAR & _WeekNumberISO() Thanks Link to comment Share on other sites More sharing options...
DaRam Posted April 24, 2008 Share Posted April 24, 2008 This should do it (add error checks) #include <Date.au3> $newfolder = "C:\Output\" & @YEAR & _WeekNumberISO() $oldfolder = "C:\Output\" & @YEAR & _WeekNumberISO() - 4 If FileExists($oldfolder) Then DirRemove($oldfolder, 1) DirCreate($newfolder) MsgBox(0, "Weekly Folders", "Created: " & $newfolder & @CRLF & "Removed: " & $oldfolder) One last quickie question.What was the previous question Link to comment Share on other sites More sharing options...
martin Posted April 24, 2008 Share Posted April 24, 2008 (edited) This should do it (add error checks) #include <Date.au3> $newfolder = "C:\Output\" & @YEAR & _WeekNumberISO() $oldfolder = "C:\Output\" & @YEAR & _WeekNumberISO() - 4 If FileExists($oldfolder) Then DirRemove($oldfolder, 1) DirCreate($newfolder) MsgBox(0, "Weekly Folders", "Created: " & $newfolder & @CRLF & "Removed: " & $oldfolder) What was the previous question Tut tut Maybe the previous question was "What happens if the week nummber is less than 5?", though to be fair you did say to add error checks. $oldweek = _WeekNumberISO() - 4 $oldyear = @Year if $oldweek < 1 then $oldweek += 52 $oldyear -= 1 endif $oldfolder = "C:\Output\" & $oldyear & $oldweek Edited April 24, 2008 by martin Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script. Link to comment Share on other sites More sharing options...
DaRam Posted April 24, 2008 Share Posted April 24, 2008 Tut tutMaybe the previous question was "What happens if the week nummber is less than 5?", though to be fair you did say to add error checks.Accepted imaginary previous question, perhaps it should have been next question? Don't you hate it when the original poster does not bother to check/respond/thank ! Link to comment Share on other sites More sharing options...
jben Posted April 24, 2008 Author Share Posted April 24, 2008 hey daram...I do respond... Sorry..Just had a really bad headache today and not feeling greay...Haven't had chance to try the code yet...Was going to try it out but had some problems with the code i'm going to use this with, therefore i tried fixing my code but started to get a severe headache so been taking a break. Thanks everyone for your responses... Link to comment Share on other sites More sharing options...
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