Results 1 to 4 of 4

Thread: How to make a simple Sorting batch file?

  1. #1
    Join Date
    Jan 2012
    Posts
    2

    How to make a simple Sorting batch file?

    I am still a students and just new here in the forum..
    Can anyone help me on how to make a simple SORT files using a batch files!!
    This will be used in our final project so that I can graduate..
    Frankly speaking, I am not very familiar with batch file..

    Anyone ??? Please...

  2. #2
    Join Date
    May 2009
    Posts
    529

    Re: How to make a simple Sorting batch file?

    There is a software called as FileSieve. This tool will allow you to sort file and folders with this tool. It is quiet simpler like copy pasting file. You just need to chose the directory for the files to be sort and start the tool which generates a script for the process.There are many more things you can try in FleSieve. There are around 13 methods that you can try out.

  3. #3
    Join Date
    Jan 2012
    Posts
    2

    Re: How to make a simple Sorting batch file?

    Okay..But my instructor want to have a code in Batch Command...
    Can anyone know here how to code it??

  4. #4
    Join Date
    Jan 2006
    Posts
    605

    Re: How to make a simple Sorting batch file?

    Check the below quicksort in a batch file:
    Code:
    @echo off
    SETLOCAL ENABLEDELAYEDEXPANSION
    
    call :qSort %*
    for %%i in (%return%) do set results=!results! %%i
    echo Sorted result: %results%
    ENDLOCAL
    goto :eof
    
    :qSort
    SETLOCAL
        set list=%*
        set size=0
        set less=
        set greater=
        for %%i in (%*) do set /a size=size+1
        if %size% LEQ 1 ENDLOCAL & set return=%list% & goto :eof
        for /f "tokens=2* delims== " %%i in ('set list') do set p=%%i & set body=%%j
        for %%x in (%body%) do (if %%x LEQ %p% (set less=%%x !less!) else (set greater=%%x !greater!))
        call :qSort %less%
        set sorted=%return%
        call :qSort %greater%
        set sorted=%sorted% %p% %return%
    ENDLOCAL & set return=%sorted%
    goto :eof
    After that call it by giving it a set of numbers to sort on the command line, seperated by spaces. Example:

    C:\dev\sorting>qsort.bat 1 3 5 1 12 3 47 3
    Sorted result: 1 1 3 3 3 5 12 47

    Also, check similar kind of topic here - Dos batch file to sort files based on file names.

Similar Threads

  1. Create a simple IP Tool Batch File.
    By Bracken in forum Software Development
    Replies: 12
    Last Post: 11-12-2011, 05:33 PM
  2. make file name list in excel using batch file
    By shibinpanayi in forum Windows Software
    Replies: 1
    Last Post: 04-06-2011, 03:44 AM
  3. Replies: 0
    Last Post: 07-03-2009, 01:39 PM
  4. A Simple File and Folder renaming batch code : RenameR
    By Rudra.J in forum Tips & Tweaks
    Replies: 2
    Last Post: 05-03-2009, 02:59 PM
  5. batch or registry file to make Firefox default browser
    By Ximen in forum Technology & Internet
    Replies: 3
    Last Post: 30-01-2009, 09:42 AM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,713,564,470.68680 seconds with 17 queries