TechSpot

Quick Way to Sort Files?

By ScRibE
Jun 16, 2008
  1. Hello everyone again,
    Does anyone know a quick way/method of sorting hundreds of thousands of files by month? The files I am trying to sort are very small (1-100KB) though there are so many of them. What I've tried so far is used windows search tool and selecting the date range in which I want. Due to the immense quantity of files, it takes about 3 hours to complete. Even when it completes, it takes even longer to move the files to a directory b/c I think windows has to search for the location again before it does the actual move. Is there a command prompt or script that I can use/create that says:
    Select the files in these date range (ie: 6/01/2007-6/31/2007) and move them to a folder called 'June 2007'?

    Thanks for your help
     
  2. raybay

    raybay TS Evangelist Posts: 10,716   +6

    Good databases can easily do it... Even Access... as will statistical databases such as Stata/MP: The fastest version of Stata (for dual-core and multicore/ multiprocessor computers), Stata/SE: Stata for large datasets, Stata/IC: The standard version of Stata, and Small Stata: A smaller, student version of Stata (for educational purchases only)
    Take a look at researcher software, or academic software.
     
  3. Spyder_1386

    Spyder_1386 TS Rookie Posts: 563

    Hey Scribe

    Microsoft Excel (part of Microsoft Office) should also be able to do it.... SAS (statistical programming) is another that works well....

    Spyder_1386 :)
     
  4. ScRibE

    ScRibE TS Rookie Topic Starter Posts: 28

    I've been trying to use Excel (2007) and it can only import 163 rows( 163 files). I know there are a lot more files than that.

    SAS, is that the actual program name?
     
  5. jobeard

    jobeard TS Ambassador Posts: 13,467   +327

    SAS is a big, expensive commercial program -- not a solution for home users.

    You want file names imported, not the files themselves, right?

    Get a command prompt and enter
    dir >myfile_list.txt​
    then use excel to import myfile_list.txt

    the command prompt will be sitting on \Documents & Settings\Yourlogin\
    so you may need to move to the correct location using CD somedir\someotherdir first
     
  6. BlackTen

    BlackTen TS Rookie

    write java code

    I'd write a java program.
     
  7. jobeard

    jobeard TS Ambassador Posts: 13,467   +327

    I'll have the Excel sorted result before you finish the first compile :)
     
  8. ScRibE

    ScRibE TS Rookie Topic Starter Posts: 28

    Thanks everyone, I was able to use command prompt and Excell to import the file list. From within Excell, I was able to sort the files by month and I use a formula
    ( CONCATENATE ) to write a script to move the files. Out of 1mil plus files, I now have left 80,000 that I can not move. I believe its b/c the files name are sooo long that the script *can't find the file. When I tried to move two files manually, it does not work. When I select one file, it works. With 80K files left, this will be very time consuming. I can't change the file name either (not that windows does not allow me, I just can't ).

    Any help is greatly appreciated.
     
  9. kimsland

    kimsland Ex-TechSpotter Posts: 18,353

    try the filename suffix (ie *.xls) the * denotes all files

    The short filename can be abreviated to 123456~1.*
    which is the first 6 letters, you need to put in, including any other filenames with the same first 6 letters
    The ~1 means all other letters after that (even if different)
    The .* means every filetype

    By the way, this may actually cause the filenames to rename to the first 6 letters~1
    (not sure exactly!)
     
  10. ScRibE

    ScRibE TS Rookie Topic Starter Posts: 28

    I just tested the method and it does not rename the file. However sorting my files by name, I realize I have a lot of files with similiar name (the first 10-20 characters)and different creation date.

    this is a long shot, is there a way for windows to automatically shorten the file name(without actually renaming the file) to make it easier to move? :)
     
  11. jobeard

    jobeard TS Ambassador Posts: 13,467   +327

    don't forget that some files have spaces in the path or the file itself
    \Documents and Settings\foo bar.zip
     
     
  12. ScRibE

    ScRibE TS Rookie Topic Starter Posts: 28

    Thanks!
    an example of the files i'm dealing with [aaa bbb ccc] xxxxxxxxxxxxx eeekkdd sllee..........
    you get the point.
     
  13. kimsland

    kimsland Ex-TechSpotter Posts: 18,353

    "docume~1\foo bar.zip"

    I forgot to say you can also write the filename *xxxxxxxx (* being any letters whatsoever before the file name)

    You can also use quotes " in the filename Have a lovely day.zip = "have a lovely day.zip"
     
  14. jobeard

    jobeard TS Ambassador Posts: 13,467   +327

    >> "docume~1\foo bar.zip"
    this will work but;
    he gets the long name in the file list and would have to programmatically find and replace every form of embedded spaces,
    not all systems retain the dos 8.3 short name forms.​
    another technique to deal with embedded spaces is using quotes
    \"Documents and Settings"\"foo bar.zip"
     
Topic Status:
Not open for further replies.


Add New Comment

TechSpot Members
Login or sign up for free,
it takes about 30 seconds.
You may also...


Get complete access to the TechSpot community. Join thousands of technology enthusiasts that contribute and share knowledge in our forum. Get a private inbox, upload your own photo gallery and more.