Multi Commander > Script

Script to rearrange files based on weeknumber into folders with weeknumber

(1/2) > >>

Herrie:
Hello guys,

I am a bit familiar to vba scripting. What I would like to see/accomplished is that approx. 500 files are rearanged into specific (sub)folders named with the weeknumber of the files.
Example:
NOW:
file[whatever]{date = 01-01-2016}  /week 1
file[whatever]{date = 08-01-2016}  /week 2
file[whatever]{date = 15-01-2016}  /week 3
file[whatever]{date = 01-22-2016}  /week 4
file[whatever]{date = 01-29-2016}  /week 6
etc.

NEW situation
MainFolder/Week_1/file[whatever]{date = 01-01-2016}
MainFolder/Week_1/file[whatever]{date = 02-01-2016}
MainFolder/Week_1/file[whatever]{date = 03-01-2016}
MainFolder/Week_1/file[whatever]{date = 04-01-2016}

So, I need to calculate the weeknumber of each file,
use this number to:
Create a new folder with the name"Week" &[weeknumber] /one time operation for files concerned
Move the files within this weeknumber period to the newly created folder.

Jumping through the whole list of files in the [main] folder.

Q:
is it possible?
How to accomplish?

Any help would be appreciated.

Perhaps it might be an extra 'tool' as well for MC

Mathias (Author):
There is no script function that will give you the weeknum so you have to calculate that your self and that will not be easy.
The date formatting function only allows for formatting dates d/m/y in different ways.

If if you solve that it should work, You can create folders and copy files from script

Herrie:
Afterall I simplpy did the operation by hand.

Herrie:
At this moment (27-03-2017) I am back to a situation as I started with.
Mathias' suggestion did not really help me.
How can  I calculate the weeknumber?

Any simple idea to script both the 'Move' action and the 'weeknum' calculation?
I would be very pleased

AlanJB:
Herrie,
  you say that you have some scripting experience.

If so, this may be of some help:
http://www.dostips.com/forum/viewtopic.php?t=7125

Also, are you trying to convert the file date to the ISO week number (where week 1 is the first week containing Jan 4th), or the American system (where Jan 1st is the beginning of week 1), or something else...?

Navigation

[0] Message Index

[#] Next page

Go to full version