Diary folders

Discuss and share scripts and script files...
Post Reply
Stefan
Posts: 1360
Joined: 18 Nov 2008 21:47
Location: Europe

Diary folders

Post by Stefan »

SkyFrontier 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.

Code: Select all

2009
2009/11
2009/11/30
2009/11/29
2009/11/28
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". :wink:
Thank you very much!
I don't anderstood this part
a customizable way to to include yyyy-mm-dd in the final links?
What do you mean by "include"?
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? :D
Last edited by Stefan on 10 Aug 2010 08:03, edited 1 time in total.

SkyFrontier
Posts: 2341
Joined: 04 Jan 2010 14:27
Location: Pasárgada (eu vou!)

Re: Diary folders

Post by SkyFrontier »

Part of the idea is to have a list similar to what we have discussed here, something like

Code: Select all

http://www.test.com/tasks/2009-12-29/text
http://www.test.com/tasks/2009-12-30/text
http://www.test.com/tasks/2009-12-31/text
That's what
a customizable way to to include yyyy-mm-dd in the final links?
is all about.
Concerning the script you've done, it's great, except that each month could have 31 numbered subfolders each, like this:

Code: Select all

C:\tmp\2009\01Jan\01
...
C:\tmp\2009\01Jan\31
-will the initial user input always have the current year as a default suggestion? If so, great!
EDIT: The code seems to be able to do that, but with tests changing default "2010" to "2009", something went wrong...
Last edited by SkyFrontier on 09 Aug 2010 23:46, edited 1 time in total.
New User's Ref. Guide and Quick Setup Guide can help a bit! Check XYplorer Resources Index for many useful links!
Want a new XYperience? XY MOD - surfYnXoard
-coz' the aim of computing is to free us to LIVE...

SkyFrontier
Posts: 2341
Joined: 04 Jan 2010 14:27
Location: Pasárgada (eu vou!)

Re: Diary folders

Post by SkyFrontier »

Found what's wrong:

Code: Select all

$DayFolders="ye"; //create folders for each day of month too?
should read

Code: Select all

$DayFolders="yes"; //create folders for each day of month too?
As I can see in the code, is your idea to ask user which months will be created, also?

Code: Select all

status "Create month: " . $MonthDirName . " day " . $Day; //nice but needs time
I mean... Still not done, right?
Any way, thank you very much - hope photographers out there find some help in this thread!
In any case, I would like to put some tags so they can find this one easily:

Code: Select all

Photograph - camera - photo - foto - picture - shoot - automate - automation - create - creation - digital - digicam - catalog - library
New User's Ref. Guide and Quick Setup Guide can help a bit! Check XYplorer Resources Index for many useful links!
Want a new XYperience? XY MOD - surfYnXoard
-coz' the aim of computing is to free us to LIVE...

SkyFrontier
Posts: 2341
Joined: 04 Jan 2010 14:27
Location: Pasárgada (eu vou!)

Re: Diary folders

Post by SkyFrontier »

Can I have months in format "01, 02, 03...", instead of "1,2,3..." when I set

Code: Select all

$MonthName="NO";  //use month name like "Jan" instead of "1"?
If I tell YES, it correctly creates "01Jan, 02Feb..."
Thank you!
New User's Ref. Guide and Quick Setup Guide can help a bit! Check XYplorer Resources Index for many useful links!
Want a new XYperience? XY MOD - surfYnXoard
-coz' the aim of computing is to free us to LIVE...

Stefan
Posts: 1360
Joined: 18 Nov 2008 21:47
Location: Europe

Re: Diary folders

Post by Stefan »

SkyFrontier wrote:Found what's wrong:

Code: Select all

$DayFolders="ye"; //create folders for each day of month too?
should read

Code: Select all

$DayFolders="yes"; //create folders for each day of month too?
Everything other than "yes" means "NO". So "ye" means this option is just disabled.
As I can see in the code, is your idea to ask user which months will be created, also?

Code: Select all

status "Create month: " . $MonthDirName . " day " . $Day; //nice but needs time
I mean... Still not done, right?
No. Every month is created always for every year.
This piece of code puts just an message in the status line.

Stefan
Posts: 1360
Joined: 18 Nov 2008 21:47
Location: Europe

Re: Diary folders

Post by Stefan »

SkyFrontier wrote:Concerning the script you've done, it's great, except that each month could have 31 numbered subfolders each, like this:
Just modify lines like
if($month=="1") {$MonthDirName = "02Feb"; $DayAmount = "28";}
to
if($month=="1") {$MonthDirName = "02Feb"; $DayAmount = "31";}


SkyFrontier wrote:Can I have months in format "01, 02, 03...", instead of "1,2,3..." when I set

Code: Select all

$MonthName="NO";  //use month name like "Jan" instead of "1"?
If I tell YES, it correctly creates "01Jan, 02Feb..."
Thank you!
Just modify lines like
if($month=="1") {$MonthDirName = "01Jan"; $DayAmount = "31";}
to
if($month=="1") {$MonthDirName = "01"; $DayAmount = "31";}

SkyFrontier
Posts: 2341
Joined: 04 Jan 2010 14:27
Location: Pasárgada (eu vou!)

Re: Diary folders

Post by SkyFrontier »

Stefan:

Code: Select all

Just modify lines like
if($month=="1") {$MonthDirName = "01Jan"; $DayAmount = "31";}
to
if($month=="1") {$MonthDirName = "01"; $DayAmount = "31";}
...doing that completely removes the option to have months' names, which I like...
Any way, I realized I could

Code: Select all

Right click on files > Batch Rename (default SHIFT+F2) > add "0*" to the field
or later append equivalent code in your script and get the job done, too. Will post some day if I guess it right, it's not a prio for me but for the sake of newcomers which can find this useful, as earlier this year I saw a discussion regarding massive photo shoots having to be easily sorted out.
New User's Ref. Guide and Quick Setup Guide can help a bit! Check XYplorer Resources Index for many useful links!
Want a new XYperience? XY MOD - surfYnXoard
-coz' the aim of computing is to free us to LIVE...

Stefan
Posts: 1360
Joined: 18 Nov 2008 21:47
Location: Europe

Re: Diary folders

Post by Stefan »

SkyFrontier wrote:Stefan:

Code: Select all

Just modify lines like
if($month=="1") {$MonthDirName = "01Jan"; $DayAmount = "31";}
to
if($month=="1") {$MonthDirName = "01"; $DayAmount = "31";}
...doing that completely removes the option to have months' names, which I like...
Any way, I realized I could

Code: Select all

Right click on files > Batch Rename (default SHIFT+F2) > add "0*" to the field
or later append equivalent code in your script and get the job done, too. Will post some day if I guess it right, it's not a prio for me but for the sake of newcomers which can find this useful, as earlier this year I saw a discussion regarding massive photo shoots having to be easily sorted out.
AH, this morning i see i was wrong. I've updated the code above.

SkyFrontier
Posts: 2341
Joined: 04 Jan 2010 14:27
Location: Pasárgada (eu vou!)

Re: Diary folders

Post by SkyFrontier »

Stefan:
AH, this morning i see i was wrong. I've updated the code above.
...which works perfectly! Thank you! (Hope I'll find some personal usage to it, also... Few days ago this would be great! But who knows what comes next?)
New User's Ref. Guide and Quick Setup Guide can help a bit! Check XYplorer Resources Index for many useful links!
Want a new XYperience? XY MOD - surfYnXoard
-coz' the aim of computing is to free us to LIVE...

Post Reply