Sorting the contents of directory

Discussion in 'Microsoft Windows 2000 CMD Promt' started by Pal, May 14, 2004.

  1. Pal

    Pal Guest

    Hello, I need a batch file to do the following: Can some
    one please help.

    1. Check the contents of C:\INPUT\
    2. Check the present month and create a sub folder
    C:\INPUT\<MMMYY>\ if it doesn't exist.
    3.Check the system date and create a sub folder
    C:\INPUT\<MMMYY>\<DDMMM>.
    4. Move C:\INPUT\*.* to C:\INPUT\<MMMYY>\<DDMMM>\*.*
     
    Pal, May 14, 2004
    #1
    1. Advertisements

  2. On Fri, 14 May 2004 10:28:59 -0700, "Pal" <>
    wrote:

    >Hello, I need a batch file to do the following: Can some
    >one please help.
    >
    >1. Check the contents of C:\INPUT\
    >2. Check the present month and create a sub folder
    >C:\INPUT\<MMMYY>\ if it doesn't exist.
    >3.Check the system date and create a sub folder
    >C:\INPUT\<MMMYY>\<DDMMM>.
    >4. Move C:\INPUT\*.* to C:\INPUT\<MMMYY>\<DDMMM>\*.*


    Place UnivDate.bat from tip 4835 in the 'Tips & Tricks' at http://www.jsiinc.com
    into a folder that is in your PATH, and mmm.bat from tip 6837

    @echo off
    setlocal
    call univdate
    if "%yy%" GTR "99" set yy=%yy:~2,2%
    set mm=100%mm%%%100
    set dd=100%dd%%%100
    if %dd% LSS 10 set dd=0%dd%
    if %mm% LSS 10 set mm=0%mm%
    call mmm month
    if not exist c:\input\%month%%yy% md c:\input\%month%%yy%
    if not exist c:\input\%month%%yy%\%dd%%month% md
    c:\input\%month%%yy%\%dd%%month%
    REM the above 2 lines are 1 line
    move c:\input\*.* c:\input\%month%%yy%\%dd%%month%




    Jerold Schulman
    Windows: General MVP
    JSI, Inc.
    http://www.jsiinc.com
     
    Jerold Schulman, May 14, 2004
    #2
    1. Advertisements

  3. On Fri, 14 May 2004 10:28:59 -0700, "Pal" <>
    wrote:

    >Hello, I need a batch file to do the following: Can some
    >one please help.
    >
    >1. Check the contents of C:\INPUT\
    >2. Check the present month and create a sub folder
    >C:\INPUT\<MMMYY>\ if it doesn't exist.
    >3.Check the system date and create a sub folder
    >C:\INPUT\<MMMYY>\<DDMMM>.
    >4. Move C:\INPUT\*.* to C:\INPUT\<MMMYY>\<DDMMM>\*.*


    Oops. Here is a revised post:

    Place UnivDate.bat from tip 4835 in the 'Tips & Tricks' at http://www.jsiinc.com
    into a folder that is in your PATH, and mmm.bat from tip 6837

    @echo off
    setlocal
    call univdate
    set /a yy=10000%yy%10000
    if %yy% GTR 99 set yy=%yy:~2,2%
    set /a mm=100%mm%%%100
    set /a dd=100%dd%%%100
    if %dd% LSS 10 set dd=0%dd%
    if %mm% LSS 10 set mm=0%mm%
    call mmm month
    if not exist c:\input\%month%%yy% md c:\input\%month%%yy%
    if not exist c:\input\%month%%yy%\%dd%%month% md
    c:\input\%month%%yy%\%dd%%month%
    REM the above 2 lines are 1 line
    move c:\input\*.* c:\input\%month%%yy%\%dd%%month%



    Jerold Schulman
    Windows: General MVP
    JSI, Inc.
    http://www.jsiinc.com
     
    Jerold Schulman, May 14, 2004
    #3
  4. Pal

    Pal Guest

    Hi Jerold,

    There may be some programming error. Because, I get
    created a folder MAY-1 instead of MAY04. How to fix this?

    Thanks in advance.

    >-----Original Message-----
    >On Fri, 14 May 2004 10:28:59 -0700, "Pal"

    <>
    >wrote:
    >
    >>Hello, I need a batch file to do the following: Can

    some
    >>one please help.
    >>
    >>1. Check the contents of C:\INPUT\
    >>2. Check the present month and create a sub folder
    >>C:\INPUT\<MMMYY>\ if it doesn't exist.
    >>3.Check the system date and create a sub folder
    >>C:\INPUT\<MMMYY>\<DDMMM>.
    >>4. Move C:\INPUT\*.* to C:\INPUT\<MMMYY>\<DDMMM>\*.*

    >
    >Oops. Here is a revised post:
    >
    >Place UnivDate.bat from tip 4835 in the 'Tips & Tricks'

    at http://www.jsiinc.com
    >into a folder that is in your PATH, and mmm.bat from tip

    6837
    >
    >@echo off
    >setlocal
    >call univdate
    >set /a yy=10000%yy%10000
    >if %yy% GTR 99 set yy=%yy:~2,2%
    >set /a mm=100%mm%%%100
    >set /a dd=100%dd%%%100
    >if %dd% LSS 10 set dd=0%dd%
    >if %mm% LSS 10 set mm=0%mm%
    >call mmm month
    >if not exist c:\input\%month%%yy% md c:\input\%month%%yy%
    >if not exist c:\input\%month%%yy%\%dd%%month% md
    >c:\input\%month%%yy%\%dd%%month%
    >REM the above 2 lines are 1 line
    >move c:\input\*.* c:\input\%month%%yy%\%dd%%month%
    >
    >
    >
    >Jerold Schulman
    >Windows: General MVP
    >JSI, Inc.
    >http://www.jsiinc.com
    >.
    >
     
    Pal, May 18, 2004
    #4
    1. Advertisements

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Dean Wells

    Re: Hide contents of .cmd file

    Dean Wells, Jun 30, 2003, in forum: Microsoft Windows 2000 CMD Promt
    Replies:
    0
    Views:
    979
    Dean Wells
    Jun 30, 2003
  2. Herb Martin

    Re: Hide contents of .cmd file

    Herb Martin, Jun 30, 2003, in forum: Microsoft Windows 2000 CMD Promt
    Replies:
    2
    Views:
    755
    Herb Martin
    Jul 21, 2003
  3. jpr_za

    Clear run command contents

    jpr_za, Feb 27, 2004, in forum: Microsoft Windows 2000 CMD Promt
    Replies:
    1
    Views:
    213
    Dave Patrick
    Feb 27, 2004
  4. djc

    compare directory contents

    djc, Apr 16, 2004, in forum: Microsoft Windows 2000 CMD Promt
    Replies:
    4
    Views:
    373
  5. Dan

    Reading text file contents into variable

    Dan, Aug 5, 2004, in forum: Microsoft Windows 2000 CMD Promt
    Replies:
    1
    Views:
    418
    Matthias Tacke
    Aug 5, 2004
Loading...

Share This Page