simple vbscript to sort your files (1 Viewer)

rolls1400

Portal Pro
August 26, 2007
132
3
Home Country
United States of America United States of America
I created a script to move all my files from my torrent folder to there correct folder. It checks the filename ("smallville")then sends it to the corresponding folder "\\MEDIACENTER\Documents\My Movies\TV Shows". Make sure to replace all of the filenames and directories, also just duplicate this code

Code:
Case InStr(LCase(sFile),LCase("example")) <> 0
  sDestinationFolder = "\\MEDIACENTER\Documents\example"

if you want to setup multiple paths.I am sure alot of people know how to do this but if you dont it makes things ALOT easier!! I am new to vb so if anyone has anything to add that would be great!!


Just paste in notepad than save the file as "whatever.vbs" (use quotations) Change the red text inside quotations.

Code:
Dim sOriginFolder, sDestinationFolder, sFile, oFSO
Set oFSO = CreateObject("Scripting.FileSystemObject")
sOriginFolder = "C:\Documents and Settings\All Users\Documents\My Torrents"
sDestinationFolder = "\\MEDIACENTER\Documents\My Movies\Movies"
For Each sFile In oFSO.GetFolder(sOriginFolder).Files
Select Case True
 [COLOR="Red"]Case InStr(LCase(sFile),LCase("axxo")) <> 0
  sDestinationFolder = "\\MEDIACENTER\Documents\My Movies\Movies"
 Case InStr(LCase(sFile),LCase("survivor")) <> 0
  sDestinationFolder = "\\MEDIACENTER\Documents\My Movies\My TV Series\Survivor"
 Case InStr(LCase(sFile),LCase("smallville")) <> 0
  sDestinationFolder = "\\MEDIACENTER\Documents\My Movies\My TV Series\Smallville"[/COLOR]
 Case Else
End Select 
 If Not oFSO.FileExists(sDestinationFolder & "\" & oFSO.GetFileName(sFile)) Then
  oFSO.GetFile(sFile).Copy sDestinationFolder & "\" & oFSO.GetFileName(sFile),True
 End If
Next

WScript.Echo "Copying :  All the files have been " & sMorC & " to " & sDestinationFolder
 

Users who are viewing this thread

Top Bottom