File tree Expand file tree Collapse file tree 1 file changed +11
-1
lines changed Expand file tree Collapse file tree 1 file changed +11
-1
lines changed Original file line number Diff line number Diff line change @@ -31,6 +31,7 @@ void main(List<String> arguments) async {
3131 abbr: 'i' , help: 'Input folder with *all* takeouts extracted' )
3232 ..addOption ('output' ,
3333 abbr: 'o' , help: 'Output folder where all photos will land' )
34+ ..addFlag ('divide-to-dates' , help: 'Divide output to folders by year/month' )
3435 ..addFlag ('skip-extras' , help: 'Skip extra images (like -edited etc)' )
3536 ..addFlag (
3637 'guess-from-name' ,
@@ -277,8 +278,17 @@ void main(List<String> arguments) async {
277278 width: barWidth,
278279 );
279280 await for (final m in Stream .fromIterable (media)) {
281+ final date = m.dateTaken;
282+ final folder = args['divide-to-dates' ]
283+ ? Directory (
284+ date == null
285+ ? p.join (output.path, 'date-unknown' )
286+ : p.join (output.path, '${date .year }' , '${date .month }' ),
287+ )
288+ : output;
289+ if (args['divide-to-dates' ]) await folder.create (recursive: true );
280290 final freeFile =
281- findNotExistingName (File (p.join (output .path, p.basename (m.file.path))));
291+ findNotExistingName (File (p.join (folder .path, p.basename (m.file.path))));
282292 final c = args['copy' ]
283293 ? await m.file.copy (freeFile.path)
284294 : await m.file.rename (freeFile.path);
You can’t perform that action at this time.
0 commit comments