ATTENTION: You are viewing a page formatted for mobile devices; to view the full web page, click HERE.

DonationCoder.com Software > Post New Requests Here

IDEA: Program to create subfolders and move files for list of shows BY name.

(1/6) > >>

famewolf:
I am requesting a program that given a list of filenames such as:

Airwolf-2009-06-11-0.tp
Airwolf-2009-06-11-0.tp.index.dat
Airwolf-2009-06-11-0.tp.inprogress.xml
Airwolf-2009-06-11-0.tp.timeindex.dat
A-Team-2009-06-11-0.tp
A-Team-2009-06-11-0.tp.chapters.xml
A-Team-2009-06-11-0.tp.index.dat
A-Team-2009-06-11-0.tp.timeindex.dat
A-Team-2009-06-11-1.tp
A-Team-2009-06-11-1.tp.AudioStats.xml
A-Team-2009-06-11-1.tp.index.dat
A-Team-2009-06-11-1.tp.timeindex.dat
A-Team-2009-06-11-1.tp.VideoStats.xml
Knight Rider-2009-06-11-0.tp
Knight Rider-2009-06-11-0.tp.chapters.xml
Knight Rider-2009-06-11-0.tp.index.dat
Knight Rider-2009-06-11-0.tp.timeindex.dat
Rockford Files-2009-06-11-0.tp
Rockford Files-2009-06-11-0.tp.chapters.xml
Rockford Files-2009-06-11-0.tp.index.dat
Rockford Files-2009-06-11-0.tp.timeindex.dat

will create a subfolder for each show (Airwolf, A-Team, Knight Rider, Rockford Files) or use the one that already exists and move each file to the appropriate show.  Ideally I'd like to run this daily from windows task manager at a set time to keep my shows organized.  If a file is open (being written to) the move will probably fail so the program should be able to handle this.   The path to the video folder would be passed on the command line....i.e.  filename.exe G:\Videos

There was a program for beyondtv users that did this but the author has vanished and the program now gives an "index" error of some sort.  Can anyone help us out?  

mouser:
seems like a good idea for a coding snack or small utility.. probably there are some renamers that might handle it as well.
may i suggest that the tool should use a regular expression that provides the directory name?  e.g. in your case it would be ^(.*)-\d\d\d\d

Target:
here's a simple AHK script that does what you're looking for


--- ---
#singleinstance

ifnotexist, showme.ini
msgbox, INI not found - script will exit

iniread, SPath, ShowMe.ini, Paths, source
iniread, TPath, ShowMe.ini, Paths, target

loop, %spath%\*.*,0,0
{
    RegExMatch(a_loopfilename, "P)^(.*)-\d\d\d\d",TmpVar)
    if TmpVar
    {
        NewFold:= substr(a_loopfilename,1,tmpvar-5)
        filecreatedir, %tpath%\%newfold%
        filemove, %a_loopfilefullpath%, %tpath%\%newfold%
        tmpvar:=0
    }
}

it doesn't accept command line parameters (I just knocked this up in my lunch hour) so source and output directories are in an ini file in the format

[PATHS]
Source = d:\temp
Target = d:\temp

if the ini file doesn't exist the script will exit

(All credit to Mouser for the RegEx tip, else I wouldn't have worked this out  :-[)

famewolf:
Thank you for the script!  How would you handle multiple source/target's?   Just repeat them in the ini?  The ini goes in same dir as the script?  I'm downloading autohotkey which I haven't used previously so will read up on it.  Sorry if I asked something obvious once reading up on AHK.

Target:
sorry, AHK is required to run the script, but the script can be compiled into a stand alone (attached) if you like

if you use the installer the script can go anywhere as the installation process sets up the associations

Hadn't considered multiple sources and/or targets - how many do you have?

Navigation

[0] Message Index

[#] Next page

Go to full version