Home | Blog | Software | Reviews and Features | Forum | Help | Donate | About us
topbanner_forum
  *

avatar image

Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
  • December 10, 2016, 12:37:09 PM
  • Proudly celebrating 10 years online.
  • Donate now to become a lifetime supporting member of the site and get a non-expiring license key for all of our programs.
  • donate

Author Topic: IDEA: Sort files and then move to new directories  (Read 5009 times)

wetsmellydog

  • Participant
  • Joined in 2007
  • *
  • default avatar
  • Posts: 104
    • View Profile
    • Donate to Member
IDEA: Sort files and then move to new directories
« on: January 07, 2009, 11:44:38 AM »
I have an abundance of files that have the same prefix ie 123.xx1, 123.xx2, 456.xx1, 456.xx2 ect that need to be sorted and then placed into a directory with the name of the prefix ie c:\123, c:\456.

I only need to define the location of the resulting directory that the files will be placed.

A batch file or AHK program would be fine with me.

Thanks as always! :)

lanux128

  • Global Moderator
  • Joined in 2005
  • *****
  • Posts: 6,258
    • View Profile
    • Coding Snacks by Lanux128
    • Read more about this member.
    • Donate to Member
Re: IDEA: Sort files and then move to new directories
« Reply #1 on: January 07, 2009, 07:01:18 PM »
this is quite a popular request, take a look at these threads and see if any of them suit your purpose.

http://www.donationc...dex.php?topic=7447.0
http://www.donationc...dex.php?topic=5269.0
http://www.donationc...ex.php?topic=12998.0

wetsmellydog

  • Participant
  • Joined in 2007
  • *
  • default avatar
  • Posts: 104
    • View Profile
    • Donate to Member
Re: IDEA: Sort files and then move to new directories
« Reply #2 on: January 08, 2009, 07:12:15 AM »
this is quite a popular request, take a look at these threads and see if any of them suit your purpose.

http://www.donationc...dex.php?topic=7447.0
http://www.donationc...dex.php?topic=5269.0
http://www.donationc...ex.php?topic=12998.0

Thanks! I will take a look.

wetsmellydog

  • Participant
  • Joined in 2007
  • *
  • default avatar
  • Posts: 104
    • View Profile
    • Donate to Member
Re: IDEA: Sort files and then move to new directories
« Reply #3 on: January 08, 2009, 07:17:45 AM »
this is quite a popular request, take a look at these threads and see if any of them suit your purpose.

http://www.donationc...dex.php?topic=7447.0
http://www.donationc...dex.php?topic=5269.0
http://www.donationc...ex.php?topic=12998.0

All are close but no cigar!  ;D


Codebyte

  • Supporting Member
  • Joined in 2007
  • **
  • Posts: 160
  • "Premature Optimization is the root of all evil."
    • View Profile
    • CodeByter.com
    • Donate to Member
Re: IDEA: Sort files and then move to new directories
« Reply #4 on: January 08, 2009, 09:20:45 AM »
I'm playing around with something for you atm... stay in touch and check this post frequently :)
CodeByter.com - http://www.codebyter.com

Codebyte

  • Supporting Member
  • Joined in 2007
  • **
  • Posts: 160
  • "Premature Optimization is the root of all evil."
    • View Profile
    • CodeByter.com
    • Donate to Member
Re: IDEA: Sort files and then move to new directories
« Reply #5 on: January 08, 2009, 12:48:04 PM »
Here is what I got out of it:

Screenshot.jpg

Features:
  • Simple Drag and Drop interface to make life easier!
  • Click Sort and watch as your files are sorted into folder's according to their filenames!
  • After File's are sorted into folders, FileSorter cleans up after itself (deletes the now empty folders)!

Download Here: http://www.codebyter...orter/FileSorter.exe

I hope this helps... I pictured your filenames to look like something to below:
-Folder
-------123.txt
-------123.zip
-------123.jpg
-------234.txt
-------234.zip
-------234.jpg

The result will be:
-Folder
------123
--------------123.txt
--------------123.zip
--------------123.jpg
------234
--------------234.txt
--------------234.zip
--------------234.jpg

Please let me know if there is anything else you would like added :)

EDIT FOR IMAGE CLARIFICATION: The progress bar at the bottom is accurate but Vista's progressbar is kind of weird so I tried to capture the progress bar in motion for you.
CodeByter.com - http://www.codebyter.com
« Last Edit: January 08, 2009, 12:51:08 PM by Codebyte »

lanux128

  • Global Moderator
  • Joined in 2005
  • *****
  • Posts: 6,258
    • View Profile
    • Coding Snacks by Lanux128
    • Read more about this member.
    • Donate to Member
Re: IDEA: Sort files and then move to new directories
« Reply #6 on: January 08, 2009, 07:55:38 PM »
Codebyte: that looks very impressive! :Thmbsup: need to bookmark this thread for future reference. :)

skrommel

  • Fastest code in the west
  • Developer
  • Joined in 2005
  • ***
  • Posts: 886
    • View Profile
    • 1 Hour Software by skrommel
    • Donate to Member
Re: IDEA: Sort files and then move to new directories
« Reply #7 on: January 10, 2009, 10:19:59 AM »
 :) Just in case you haven't found a working solution...

Skrommel

;MoveSameName.ahk
; Moves files with the same name to a common folder
;Skrommel @ 2009

from=C:\Dir1
to=C:\Dir2

Loop,%from%\*.*,0,0
{
  SplitPath,A_LoopFileLongPath,name,dir,ext,name_no_ext,drive
  MsgBOx,Moving`n %A_LoopFileLongPath%`nto`n %to%\%name_no_ext%\%name%
  FileCreateDir,%to%\%name_no_ext%
  FileMove,%A_LoopFileLongPath%,%to%\%name_no_ext%\%name%
}
Please stop by my site at  1 Hour Software by skrommel  for downloads and more info.

wetsmellydog

  • Participant
  • Joined in 2007
  • *
  • default avatar
  • Posts: 104
    • View Profile
    • Donate to Member
Re: IDEA: Sort files and then move to new directories
« Reply #8 on: January 12, 2009, 05:03:40 PM »
Here is what I got out of it:
 (see attachment in previous post)
Features:
  • Simple Drag and Drop interface to make life easier!
  • Click Sort and watch as your files are sorted into folder's according to their filenames!
  • After File's are sorted into folders, FileSorter cleans up after itself (deletes the now empty folders)!

Download Here: http://www.codebyter...orter/FileSorter.exe

I hope this helps... I pictured your filenames to look like something to below:
-Folder
-------123.txt
-------123.zip
-------123.jpg
-------234.txt
-------234.zip
-------234.jpg

The result will be:
-Folder
------123
--------------123.txt
--------------123.zip
--------------123.jpg
------234
--------------234.txt
--------------234.zip
--------------234.jpg

Please let me know if there is anything else you would like added :)

EDIT FOR IMAGE CLARIFICATION: The progress bar at the bottom is accurate but Vista's progressbar is kind of weird so I tried to capture the progress bar in motion for you.

So far looks good.
Two things that I can see;
1) Clear list button
2) Option for Move/Copy

Been busy so I have not been able to really put it through its paces but so far so good!  :)

wetsmellydog

  • Participant
  • Joined in 2007
  • *
  • default avatar
  • Posts: 104
    • View Profile
    • Donate to Member
Re: IDEA: Sort files and then move to new directories
« Reply #9 on: January 12, 2009, 05:06:27 PM »
:) Just in case you haven't found a working solution...

Skrommel

;MoveSameName.ahk
; Moves files with the same name to a common folder
;Skrommel @ 2009

from=C:\Dir1
to=C:\Dir2

Loop,%from%\*.*,0,0
{
  SplitPath,A_LoopFileLongPath,name,dir,ext,name_no_ext,drive
  MsgBOx,Moving`n %A_LoopFileLongPath%`nto`n %to%\%name_no_ext%\%name%
  FileCreateDir,%to%\%name_no_ext%
  FileMove,%A_LoopFileLongPath%,%to%\%name_no_ext%\%name%
}

It keeps asking for confirmation after each file. Will removing MSGBOx line make it more automatic?

skrommel

  • Fastest code in the west
  • Developer
  • Joined in 2005
  • ***
  • Posts: 886
    • View Profile
    • 1 Hour Software by skrommel
    • Donate to Member
Re: IDEA: Sort files and then move to new directories
« Reply #10 on: January 13, 2009, 01:35:50 AM »
 :-[ Yes.

Skrommel
Please stop by my site at  1 Hour Software by skrommel  for downloads and more info.