I don't anderstood this partSkyFrontier wrote:Dear Stefan,
Can you please provide an update to that bullets and numbering code, so I could have a customizable way to to include yyyy-mm-dd in the final links? For the sake of simplicity, I don't mind the upper limit for all "dd" values being 31 (no matter which "mm" is being written), and I think it'll be easier for you adding a "lower/maximum" user input for yyyy, defaulting "0" to current year if none is specified. As an idea, you could post similar code in another section aiming to help people that needs to create folders and subfolders to sort photos out.I know of specialized software (RoboFolder) being able to achieve that, but I think this could be interesting since you converted my original complicated method into an elegant solution. Kind of "reversing the reversal".Code: Select all
2009 2009/11 2009/11/30 2009/11/29 2009/11/28
Thank you very much!
What do you mean by "include"?a customizable way to to include yyyy-mm-dd in the final links?
Where? Example please.
Anyway here is an script to create folders for each month of an given year, incl. folders for each day, if wanted:
Code: Select all
/*
SkyFrontier Edition 2010 No.4
Diary.xys v0.2 2010-08-10 Stefan
Creates folders like:
-2010
+ 01Jan
- 02Feb
01
02
03
*/
$Year="<date yyyy>";//Create an folder-set for that year
$Year = input("Create folder for Year", ,$Year);
$MonthName="ye"; // "yes" => use month name like "01Jan" instead of "01"?
$DayFolders="ye"; // "yes" => create folders (01...31) for each day of month too?
//anything others then "yes" will disable this option: e.g. "ye" or uppercase "Yes", or "NO" or just ""
//Do:
$curpath="<curpath>";
$month=1;
while( $month <= 12 )
{
//adjust $MonthDirName to suit your needs e.g. from "01Jan" to just "January":
if($month=="1") {$MonthDirName = "01Jan"; $DayAmount = "31";}
if($month=="2") {$MonthDirName = "02Feb"; $DayAmount = "29";}
if($month=="3") {$MonthDirName = "03Mar"; $DayAmount = "31";}
if($month=="4") {$MonthDirName = "04Apr"; $DayAmount = "30";}
if($month=="5") {$MonthDirName = "05Mai"; $DayAmount = "31";}
if($month=="6") {$MonthDirName = "06Jun"; $DayAmount = "30";}
if($month=="7") {$MonthDirName = "07Jul"; $DayAmount = "31";}
if($month=="8") {$MonthDirName = "08Aug"; $DayAmount = "31";}
if($month=="9") {$MonthDirName = "09Sep"; $DayAmount = "30";}
if($month=="10"){$MonthDirName = "10Oct"; $DayAmount = "31";}
if($month=="11"){$MonthDirName = "11Nov"; $DayAmount = "30";}
if($month=="12"){$MonthDirName = "12Dec"; $DayAmount = "31";}
//if use $MonthName is disabled, create just folders with digits (01...12):
if ( $MonthName != "yes" ){
//pad the first 9 digits by an 0:
while ( strlen( $month ) < 2 ) { $month = 0$month; }
$MonthDirName = $month; }
//tell the user whats happens as status info in the status bar:
status "Create month: " . $MonthDirName; //nice info, but needs quite some time
//create new folders:
new "$curpath\$Year\$MonthDirName", dir;
//if sub-folders for each days is wanted, create one for each day:
if ($DayFolders=="yes")
{
$Day = 1;
while( $Day <= $DayAmount )
{
while ( strlen( $Day ) < 2 ) { $Day = 0$Day; }
status "Create month: " . $MonthDirName . " day " . $Day . " (Press ESC to stop)"; //nice but needs time
new "$curpath\$Year\$MonthDirName\$Day", dir;
//If somebody needs 24 sub-folders for each day... just tell us ;-)
incr $Day;
}
}
incr $month;
}
#485; //refresh file list to see the new folders
status done, folders created.;
msg "Done!";
HTH?