AutoHotkey Community

It is currently May 27th, 2012, 6:52 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 2 posts ] 
Author Message
PostPosted: September 19th, 2011, 6:44 am 
Offline

Joined: October 28th, 2006, 11:36 pm
Posts: 191
I'm trying to sort out ebooks, and one thing I'd like to do is parse a list of filenames in a directory, create a folder for each letter of the alphabet that filenames begin with, and push those files into those folders.

Alternately, I'd like to do ranges (A-E,F-K) and do the same thing.

I've done this with file dates, but I'm at a loss here.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: September 19th, 2011, 8:47 am 
Offline

Joined: May 12th, 2005, 8:20 am
Posts: 331
Location: Münster, Germany
Hi, caveatrob,
try something like this
Code:
Loop, *.*
{
  newDir:=SubStr(A_LoopFileName, 1,1)
  IfNotExist, %newDir%
  {
    FileCreateDir, %newDir%
  }
  FileCopy, %A_LoopFileName%, %newDir%
}

I suggest to specify the file pattern (*.*) and to unify the new directory names to upper or lower case.
Of course, you have to check the existence of an file named like the directory that you are going to create.
This rudimental script has to reside in the working directory, it would be better to declare a working directory and to keep it in mind for the copy commands.
Regards,
Klaus


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: migz99, sjc1000 and 68 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group