Jump to content

NewScriptJunkie

Member
  • Posts

    11
  • Joined

  • Last visited

  • Donations

    0.00 USD 
  • Country

    United Kingdom

Posts posted by NewScriptJunkie

  1. Hi GunSmokingMan, 

    Yes it would be either mp4 or avi files (only). I mention txt files just to understand the context. 

    Even though it's in quotations how does it know the file type? How is the data being put into the array as "windows media audio file" 

     

    But awesome I understand making a script to echo out the type. Will do that as soon as I'm on my laptop. 

     

    Thank you

  2. Progress - However is there seems to be a check in your code which I think is

     

    If Col.type = "Windows Media Audio file" Then

     

    I commented out (') the if statement and the end if but that creates problems later as it’s a valid check. Is there a type video or txt version of the same?

    I'm now attacking the entire project of mine from another angle which is a bit long winded code but I'm learning as I go so definitely not wasted time.

    Still working on the above too ;-)

     

    GunSmokingMan  :thumbup

  3. Thanks GunSmokinMan for the cut down code.

     

    With regards the question i was trying to use regex to look at the file name and break it down in parts to recall later and archive the file  into subfolders based on the file name.

     

    So original is located as follows T:\input\Love.TV.Series.S01E01.mp4 

     

    I was hoping i could break down parts of the file name and recall to make subfolders then place the file in the final subfolder.

     

    so (L)(ove.TV.Series).S(01)E01.mp4

    therefore (^.)(.+).S(/d{2})

     

    Then place in subfolders T:\TVseries\$1\$1$2\$3\Love.TV.Series.S01E01.mp4

     

    which would end up like  T:\TVseries\L\Love TV Series\01\Love.TV.Series.S01E01.mp4

     

    Hope thats a bit more clear. 

     

    Thanks in advance

  4. Hi Guys so my learning quest continues. 

    I've learnt to move folders now based on there names using a search string then create a folder based on the search string results. 

    This is the code thus far.

    Set objRegEx = CreateObject("VBScript.RegExp") objRegEx.Global = True   objRegEx.Pattern = "^." Set objFSO = CreateObject("Scripting.FileSystemObject")Set objFolder = objFSO.GetFolder("T:\input") Set colFiles = objFolder.Files For Each objFile in colFiles    strSearchString = objFile.Name    Set colMatches = objRegEx.Execute(strSearchString)       For Each strMatch in colMatches        strFolderName1 = strMatch.Value        strFolderName = strMatch.Value        'Next line saved for removing characters from the identified string        'strFolderName = Replace(strFolderName, "S", " ")        strFolderName = "T:\output\" & strFolderName & "\"             If Not objFSO.FolderExists(strFolderName) Then                Set objNewFolder = objFSO.CreateFolder(strFolderName)            End If    Next     objFSO.MoveFile objFile.Path, strFolderName Next '-> End Of Script Message Closes Automatically After 3 Seconds CreateObject("Wscript.Shell").Popup _ "Script Completed",3,"End Of Script",4128 
    Using the object pattern (objRegEx.Pattern = "^.") basically takes the first letter of the filename and creates the folder with the first letter and then places the file within that folder. Can I do a search on the same filename for a separate section to create a further sub-folder. So second search (objRegEx.Pattern = "S/d{2,}") which would be a further sub-folder. Then place the original file in that sub folder to the first folder. so using the sample above "T:\output\R\S01\filename.ext

     

    Hope that makes sense 

     

    Cheers in advance

  5.  

    Here are some links to help you with your scripts

    MoveHere

    Shell.Windows method

    To add copy to a filename if exists and no dialog to ask yes no

    Fld.MoveHere Obj.Path,24+Bar

    Your my hero.

    Have decided to buy a couple of books and learn it from scratch :-) 

     

    Thanks for the help 

     

    Update: Thanks again for the info I ended up using Fld.MoveHere Obj.Path,16+Bar as (24) I seemed to create a 'copy of ***' in the new destination folder if file existed. I've ordered the 'Wiley.Microsoft.PowerShell.VBScript.and.JScript.Bible.Feb.2009' book as I think that might be a good place to start on my scripting journey :-)

     

    Thanks for the links too! 

  6. Try this VBS script and see if it what you want, it will move all the folders in the parent folder to Set Fld folder and leave the parent folder empty.

    Const Bar = &H0&'-> Objects For ScriptDim Fso :Set Fso = CreateObject("Scripting.FileSystemObject")Dim Shl :Set Shl = CreateObject("Shell.Application")Dim Fld, Obj'-> Fso.GetFolder(".") Makes The Folder Whee The Script Is Located '-> The Parent Folder. Place A Pathway Fso.GetFolder("Drive:\FolderName")'-> To Use Another Folder  For Each Obj In Fso.GetFolder(".").SubFolders    '-> Check To Make Sure It Not In The Pth Folder   Set Fld = Shl.NameSpace("C:\Users\Gunsmokingman\Desktop\ToThere")   If Not Fld Is Nothing Then    'WScript.Echo Obj.Path    Fld.MoveHere Obj.Path,Bar   End If  Next'-> End Of Script Message Closes Automatically After 5 Seconds CreateObject("Wscript.Shell").Popup _ "Script Completed",5,"End Of Script",4128

    gunsmokingman,

    Thank you this worked exactly how I needed it too. I just need to make the script use the 'yes to all' or suppress the confirmation of overwrite if the folder already exists. And many thanks for the comments within the script to help me understand what part is doing what.

     

    Many Thanks

  7. Hi Guys,

    I'm new to VBS and only learn from using. I’ve search the forum for this and found similar but still can’t seem to get it right and what I’m trying to do seems so simple.  I’m using the following script to copy all files maybe 5 sub folders deep from a root folder ‘A’ to a destination folder ‘B’ but it also copies the root folder ‘A’ but I don’t want that just what’s in ‘A’ if that makes sense. The subfolders in a are never the same and change each time I run the script.  Here’s the script I have been using. So it’s the contents of A I want (not including A) to move to B. I want A (root) to remain after but no subfolder inside.  

     

    Const FOF_CREATEPROGRESSDLG = &H0&

    TargetFolder = "T:\My folder\B\"

    Set objShell = CreateObject("Shell.Application")

    Set objFolder = objShell.NameSpace(TargetFolder)

    objFolder.MoveHere "T:\My folder\A\", FOF_CREATEPROGRESSDLG

     

    Many thanks in advance

×
×
  • Create New...