Folderize Files: move file into a sub-dir named like the file's date

English support forum

Moderators: sheep, Hacker, Stefan2, white

msrox
Member
Member
Posts: 101
Joined: 2008-03-14, 00:10 UTC

Folderize Files: move file into a sub-dir named like the file's date

Post by *msrox » 2008-03-14, 00:12 UTC

I have 3000 pictures which have been taken in different dates.
I want to move them all to sub-folders with date label.
How can I do it?

StatusQuo
Power Member
Power Member
Posts: 1468
Joined: 2007-01-17, 21:36 UTC
Location: Germany

Post by *StatusQuo » 2008-03-14, 04:46 UTC

You can use the batch file below in TC's starter menu or with a button etc.
It moves every marked file into a sub-dir named like the file's date.

Code: Select all

Command   : TC_Move2DateSubDir.cmd
Parameters: %L
The batch file (decode it using TC's File -> Decode):

Code: Select all

begin 644 TC_Move2DateSubDir.cmd
M("`@0&5C:&\@;V9F#0H@("!S971L;V-A;`T*("`@<V5T(&-P06-T:79E/3`-
M"B`@('-E="!C<$]%33TP#0H-"B`@("`@(#H@<F5M(&-H96-K(&9O<B!E>&ES
M=&5N8V4@;V8@0TA#4"Y#3TTL(%)%1RY%6$4-"B`@(&-O<'D@.CHZ(&YU;"`R
M/FYU;`T*("`@8VAC<"YC;VT@+S\@/FYU;`T*("`@:68@;F]T(&5R<F]R;&5V
M96P@,2`H#0H@("`@("!C;W!Y(#HZ.B!N=6P@,CYN=6P-"B`@("`@(')E9RYE
M>&4@+S\@/FYU;`T*("`@*0T*("`@:68@97)R;W)L979E;"`Q("@-"B`@("`@
M(&5C:&\N#0H@("`@("!E8VAO("HJ*B!787)N:6YG7CH@4D5'+D5812!A;F0O
M;W(@0TA#4"Y#3TT@;F]T(&9O=6YD(%XH<V5E(&5R<F]R(&UE<W-A9V4@86)O
M=F5>*2P@#0H@("`@("!G;W1O($YO0W!3=VET8V@-"B`@("D-"B`@(&-O<'D@
M;G5L(&YU;"`^;G5L#0H-"B`@("`@(#H@<F5M(&=E="!L;V-A;"!C;V1E<&%G
M92!N=6UB97)S.R!T:&%N:W,@,B!$86QA:2!F;W(@=&AI<PT*("`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M9"`E)6@M)25F+24E
M9R`R/FYU;`T*("`@("`@;6]V92`B)25^9'!N>&4B("(E)7YD<&5<)25H+24E
M9BTE)6=<)25^;GAE(@T*("`@*0T*("`@#0H@("!G;W1O(&-E#0H-"CIC90T*
M("`@("`@.B!R96T@;&]A9"!!4T-)22]/14T@8V]D97!A9V4@86=A:6X-"B`@
M(&EF(&YO="`B)6-P3T5-)2(]/2(P(B!C:&-P+F-O;2`E8W!/14TE(#YN=6P-
M"@T*.F5X#0H-"B`@(#H@<F5M(%-Y;G1A>#H@("`E?FYX,"`B9#I<<&%T:%QF
M:6QE;&ES="YT>'0B#0H@("`-"B`@(#H@<F5M(&QI;F4@,SD@*R`T,#H@8VAA
M;F=E("(E)6@M)25F+24E9R(@;W)D97(@87,@>6]U(&QI:V4@9F]R(&1I<F5C
C=&]R>2!N86UE<RP@92YG+B!T;R`B)25H+24E9RTE)68B#0H`
`
end
sum -r/size 6184/1655
[Edit] Updated for date formats including characters forbidden in path names.
Last edited by StatusQuo on 2008-03-15, 07:10 UTC, edited 3 times in total.
Who the hell is General Failure, and why is he reading my disk?
-- TC starter menu: Fast yet descriptive command access!

msrox
Member
Member
Posts: 101
Joined: 2008-03-14, 00:10 UTC

Post by *msrox » 2008-03-14, 06:23 UTC

Thank you very much
This is the first time I want to add a command.
Would you please explain how I can do it?
Thanks in advance

StatusQuo
Power Member
Power Member
Posts: 1468
Joined: 2007-01-17, 21:36 UTC
Location: Germany

Post by *StatusQuo » 2008-03-14, 07:21 UTC

Would you please explain how I can do it?
For putting it in the starter menu:
  • - put the file somewhere on the disk (copy and paste the code above into a text editor, save it as text file, in TC put the cursor on it and call File -> Decode),
    preferrably into the TC program directory (or some dir included in the PATH system variable)
    - in TC call menu item Start -> Change Start Menu
    - press button add item, enter a name, e.g. TC_Move2DateSubDir
    - in the input boxes below enter:

    Code: Select all

    Command   : TC_Move2DateSubDir.cmd
    Parameters: %L
    
    (If you put the file somewhere else, you maybe have to include the correspondig path here.)
Now, after marking some files, you can use it by calling the menu item Start -> TC_Move2DateSubDir.

Using the button bar instead is quite similar, using Configure -> Button Bar.
Some help on using the button bar can be found using F1 key and in the TC Wiki.
Who the hell is General Failure, and why is he reading my disk?
-- TC starter menu: Fast yet descriptive command access!

msrox
Member
Member
Posts: 101
Joined: 2008-03-14, 00:10 UTC

Post by *msrox » 2008-03-14, 09:09 UTC

Thank you again,

I did all steps which you said, and I added the command successfully.
Then I selected 100 pictures which all are in a folder and then run the command.
A cmd window appeared and disappeared immediately, but nothing happened.
What's wrong?

I want a command that scans all selected pictures (files), and creates sub-folders with date label and then move files in appropriate sub-folders according to their date taken.

Thanks in advance

StatusQuo
Power Member
Power Member
Posts: 1468
Joined: 2007-01-17, 21:36 UTC
Location: Germany

Post by *StatusQuo » 2008-03-14, 17:06 UTC

msrox wrote:What's wrong?
Hm, here it's working exactly like you described.
Some ideas:
  • Most likely the command is not found - when creating the Button/Start menu entry, did you specify the path to the file?
    If you put the file into the TC program folder the "Command" field could read like

    Code: Select all

    Command   : "%COMMANDER_PATH%\TC_Move2DateSubDir.cmd"
    Parameters: %L
    
  • The double quotes are needed, if there is a space in the file name or path.
  • Are you shure you have marked some files (not folders) before calling the command?
---
I hope the above solved it. If not: To see what's going on
- please change the button/start menu entry like this to make the cmd window stay open:

Code: Select all

Command   : %COMSPEC% /k "%COMMANDER_PATH%\TC_Move2DateSubDir.cmd"
Parameters: %L
What's on the screen then?

If also this gave no hint to what's wrong, please load the file TC_Move2DateSubDir.cmd into a text editor and change the first line from
@echo off
to
rem @echo off
Then save it and run the command again from TC - what is printed on the screen then?
Who the hell is General Failure, and why is he reading my disk?
-- TC starter menu: Fast yet descriptive command access!

User avatar
petermad
Power Member
Power Member
Posts: 8994
Joined: 2003-02-05, 20:24 UTC
Location: Valsted, Denmark
Contact:

Post by *petermad » 2008-03-14, 17:49 UTC

2StatusQuo

Maybe msrox is using for example Windows 98 or another OS that doesn't support the extended cmd syntax?
License #524 (1994)
Danish Total Commander Translator
TC 9.5b8 32+64bit on Win XP 32bit, Win 7, 8.1 & 10 (1909) 64bit, 'Everything' 1.4.1.935 (x64)
TC 3.0b12 on Android 6.0
Get: Extended Total Commander Menus | PHSM-Calendar

StatusQuo
Power Member
Power Member
Posts: 1468
Joined: 2007-01-17, 21:36 UTC
Location: Germany

Post by *StatusQuo » 2008-03-14, 18:26 UTC

2petermad
Maybe msrox is using for example Windows 98
Oops, thanks for the hint, I didn't think about this.

2msrox
So, what's your Windows version? (NT4, 2000, XP, Vista should work)
Who the hell is General Failure, and why is he reading my disk?
-- TC starter menu: Fast yet descriptive command access!

msrox
Member
Member
Posts: 101
Joined: 2008-03-14, 00:10 UTC

Post by *msrox » 2008-03-14, 23:08 UTC

I cannt send the output.
Forum shows me this error, how can I send it to you?

In order to try to prevent spammers, we do not allow our users to post URLs in any form until they have posted at least 1 legitimate posts and have been with us for more than 3 days. We appreciate your understanding in this matter in order to help us eliminate spam from this forum. If you have somehow gotten this message even though you meet both of the criteria, please let us know ASAP.

Thanks!

StatusQuo
Power Member
Power Member
Posts: 1468
Joined: 2007-01-17, 21:36 UTC
Location: Germany

Post by *StatusQuo » 2008-03-15, 02:10 UTC

msrox wrote:I cannt send the output.
This url posting problem should be gone on sunday/monday...
In the meantime you can post URLs by tweaking them a little, instead of http://www.google.com you could write w w w.google.com (leaving out "http://", plus maybe adding spaces in the leading www/ftp part).

Alternatively, as it's a text window, you could copy the text to paste it here:
click the icon in the upper left cmd window corner, choose "Mark" (or similar), then select the whole window text holding the left mouse button and copy it by clicking the right mouse button or pressing the Enter key.

P.S.: What about your Windows version?
Who the hell is General Failure, and why is he reading my disk?
-- TC starter menu: Fast yet descriptive command access!

msrox
Member
Member
Posts: 101
Joined: 2008-03-14, 00:10 UTC

Post by *msrox » 2008-03-15, 04:01 UTC

Actually there isn't any web address in the text I want to send. I don't know why it recognizes a web address.
Finally I captured and uploaded it as an image. The address is :

uploads*screenshot-program*c0m**upl4853425066*jpg

change 0 to o in c0m
* means dot
** means slash

I guess it has an error in generating of new path of images (files).

User avatar
petermad
Power Member
Power Member
Posts: 8994
Joined: 2003-02-05, 20:24 UTC
Location: Valsted, Denmark
Contact:

Post by *petermad » 2008-03-15, 04:10 UTC

2msrox

http://screenshot-program.com//upl4853425066.jpg says:
Sorry, the page you requested is either under construction or doesn't exist.

Apologies, development Team

You still haven't answered what Opereting System you are using :?:


EDIT: Sorry my mistake - it should be http://uploads.screenshot-program.com/upl4853425066.jpg - then it works.
Last edited by petermad on 2008-03-15, 05:10 UTC, edited 1 time in total.
License #524 (1994)
Danish Total Commander Translator
TC 9.5b8 32+64bit on Win XP 32bit, Win 7, 8.1 & 10 (1909) 64bit, 'Everything' 1.4.1.935 (x64)
TC 3.0b12 on Android 6.0
Get: Extended Total Commander Menus | PHSM-Calendar

StatusQuo
Power Member
Power Member
Posts: 1468
Joined: 2007-01-17, 21:36 UTC
Location: Germany

Post by *StatusQuo » 2008-03-15, 04:11 UTC

http://uploads.screenshot-program.com/upl4853425066.jpg

I got it, the problem is your local date format, being "02/29/2008" (here it is "29.02.2008").
MD tries to create a directory with that name, but "/" is not allowed in path names. I'll try to replace those characters by "-".
Who the hell is General Failure, and why is he reading my disk?
-- TC starter menu: Fast yet descriptive command access!

msrox
Member
Member
Posts: 101
Joined: 2008-03-14, 00:10 UTC

Post by *msrox » 2008-03-15, 04:14 UTC

you should not remove the "uploads." from the first of address :

uploads*screenshot-program*c0m**upl4853425066*jpg

change 0 to o in c0m
* means dot
** means slash

As I wrote before I have WinXP Professional SP2

Thank you and sorry to bother you

StatusQuo
Power Member
Power Member
Posts: 1468
Joined: 2007-01-17, 21:36 UTC
Location: Germany

Post by *StatusQuo » 2008-03-15, 04:33 UTC

2msrox
I updated the code in the posting above.
The directories are now named like YYYY-MM-DD with your local date format. The last line contains a short description how to change this order as you like.
I hope it works for you, too?
Who the hell is General Failure, and why is he reading my disk?
-- TC starter menu: Fast yet descriptive command access!

Post Reply