Jump to content

Loop to decide folder name


jben
 Share

Recommended Posts

Hey everyone. I'm just wondering, is it possible to create a loop to determine a folder name

something like this:

$foldername = loop

if january 1st,2nd,3rd,4th,5th,6th then = Week1

if january 7th,8th,9th,10th,11th then = week 2

c:\output\$foldername <--the folder name is determined by the loop above.For example, if its January 1st then the folder name will be c:\output\Week 1

thanks

Edited by jben
Link to comment
Share on other sites

if january 1st,2nd,3rd,4th,5th,6th then = Week1

are you menting about the date of file or just the name of folder ?

[quote]Don't expect for a perfect life ... Expect a least troubles ones[/quote]Contact me : ass@kiss.toWhat I Have Done :Favorites Manager Mangage your favorite's folder, that's coolPC Waker For those who want to save stickersWebScipts Supporter For those who've just started with Web and WebScriptsTemporary Looker Simple but powerful to manage your Temporary folder, you know what you downloaded[UDF] _NumberFormat() Better performance on number display[UDF] _DirGet() What a folder contain [how many (hidden,normal,...) files], with one line of code[UDF] _IsPressEs() Just like _IsPress() but for a group of keys

Link to comment
Share on other sites

#include <date.au3>
Dim $date[3]=[2008,04,21]
DirCreate(@YEAR & _WeekNumberISO($date[0],$date[1],$date[2]))

[quote]Don't expect for a perfect life ... Expect a least troubles ones[/quote]Contact me : ass@kiss.toWhat I Have Done :Favorites Manager Mangage your favorite's folder, that's coolPC Waker For those who want to save stickersWebScipts Supporter For those who've just started with Web and WebScriptsTemporary Looker Simple but powerful to manage your Temporary folder, you know what you downloaded[UDF] _NumberFormat() Better performance on number display[UDF] _DirGet() What a folder contain [how many (hidden,normal,...) files], with one line of code[UDF] _IsPressEs() Just like _IsPress() but for a group of keys

Link to comment
Share on other sites

If you want the actual week of the month you could use this. And create the directory as Year\Month\Week #, for instance 2008\April\Week 4.

#include <Date.au3>
DirCreate(@YEAR & "\" & @MON & "\" & "Week " & _GetWeekOfMonth())

Func _GetWeekOfMonth($iYear = @YEAR, $iMonth = @MON, $iDay = @MDAY)
    Local $iDayOffset = _DateToDayOfWeek($iYear, $iMonth, 1) - 1
    If Mod(($iDay + $iDayOffset),7) = 0 Then
        Return Int(($iDay + $iDayOffset)/7)
    Else
        Return Int((($iDay + $iDayOffset)/7)+1)
    EndIf
EndFunc
Edited by zorphnog
Link to comment
Share on other sites

Fixed it now...I just used this:

#include <date.au3>

Dim $date[3]=[@YEAR,@MON,@MDAY]

DirCreate(@YEAR & _WeekNumberISO($date[0],$date[1],$date[2]))

Thanks everyone for the help Edited by jben
Link to comment
Share on other sites

Hey. I've made an improvement to my code. The only problem I have is the "Somerset" bit is not working

What i'm trying to achieve is move the contents of the c:\OUTPUT\MASTER folder to C:\OUTPUT\YEARWEEKNUMBER\Somerset

which in this case would be moving the contents of MASTER folder to C:\OUTPUT\200817\Somerset.

Anyone have any ideas?...thanks

#include <date.au3>
Dim $date[3]=[@YEAR,@MON,@MDAY]
DirMove ("C:\OUTPUT\MASTER","C:\OUTPUT\" & @YEAR &_WeekNumberISO($date[0],$date[1],$date[2]"\Somerset"))
Edited by jben
Link to comment
Share on other sites

#include <date.au3>
Dim $date[3]=[@YEAR,@MON,@MDAY]
DirMove ("C:\OUTPUT\MASTER","C:\OUTPUT\" & @YEAR &_WeekNumberISO($date[0],$date[1],$date[2]) & "\Somerset")[/code]oÝ÷ Ø  l¢'ò¢íý­æ¥Á¬¬ºÈ§Ø^rêëz{]jײ¢çhmçkMúu«^jºÚÉ«­¢+Ø¥¹±Õ±ÐíѹÔÌÐì)¥É5½Ù ÅÕ½ÐíèÀäÈí=UQAUPÀäÈí5MQHÅÕ½Ðì°ÅÕ½ÐíèÀäÈí=UQAUPÀäÈìÅÕ½ÐìµÀìeHµÀí}]­9ÕµÉ%M

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...