DonationCoder.com Software > Coding Snacks
Automated folder maker
(1/1)
KoenFugro:
Hi all,
I have a a few directory's containing hundreds of PDF documents.
All the documents are in the root of that directory, but i want each PDF to be in a folder named the same as the PDF file.
This should be done automatically I, couse it is very time consuming if I do it by hand.
Is there a simple code / tool to do this?
Kind regards,
Koen Franssen
aCkRiTe:
Here is an AHK script that should do it for you. This assumes you have 1 directory with many .pdf files in it, it will loop through getting each file name and create a new directory(within the main/root directory) with the current file name then move the file in to the new directory with the matching name.
*I have tested, but you should always have a backup or copy of the directory you're working on before using this script*
--- ---#SingleInstance Force
#Persistent
#NoEnv
SetBatchLines -1
FileSelectFolder, Root, , , Select Root Folder
If ErrorLevel = 1
Reload
Loop, %Root%\*.pdf
{
StringTrimRight, Folder, A_LoopFileName, 4
FileCreateDir, %Root%\%Folder%
FileMove, %A_LoopFileFullPath%, %Root%\%Folder%\%A_LoopFileName%
}
ExitApp
KoenFugro:
Thanks aCkRiTe!
I tested this script and it works great!
I looked in your code and noticed that I can use it for other files too!
lokoman:
filenanny can do the work too.
Navigation
[0] Message Index
Go to full version