PC Review


Reply
Thread Tools Rate Thread

Sorting the contents of directory

 
 
Pal
Guest
Posts: n/a
 
      14th May 2004
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>\*.*
 
Reply With Quote
 
 
 
 
Jerold Schulman
Guest
Posts: n/a
 
      14th May 2004
On Fri, 14 May 2004 10:28:59 -0700, "Pal" <(E-Mail Removed)>
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
 
Reply With Quote
 
 
 
 
Jerold Schulman
Guest
Posts: n/a
 
      14th May 2004
On Fri, 14 May 2004 10:28:59 -0700, "Pal" <(E-Mail Removed)>
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
 
Reply With Quote
 
Pal
Guest
Posts: n/a
 
      18th May 2004
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"

<(E-Mail Removed)>
>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
>.
>

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
System.IO.Directory.GetDirectories() and System.IO.Directory.GetFiles() are not returning the specified directory Nathan Sokalski Microsoft ASP .NET 2 6th Sep 2007 04:58 PM
Sorting Sorting Sorting =?Utf-8?B?U2t5ZGl2ZXI=?= Microsoft Excel Misc 4 3rd Jun 2006 02:42 PM
Copying directory contents to another directory with same name? VMI Microsoft C# .NET 1 24th Nov 2004 11:49 PM
RE: Sorting the contents of a directory Pal Microsoft Windows 2000 CMD Promt 0 18th May 2004 11:31 PM
Printing the contents (list of contents) of a Directory Claude Martin Windows XP Print / Fax 2 18th Dec 2003 01:38 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 03:37 PM.