Help Needed with Searching File/Folder/Move .Bat file

Page 1 of 2 12 LastLast

  1. Posts : 25
    Windows 7 Ultimate x64
       #1

    Help Needed with Searching File/Folder/Move .Bat file


    I've been searching the last 2 hours on a solution to my problem & have yet to find an answer so I thought I would post it here.

    Description of Problem:

    I have a folder dedicated for songs (guitar tabs & chords) that are .htm extensions, however I would like to move these songs to the/an appropriate Artist folder.

    For Example: (current DIR layout)
    Folder \ songtitlewithnospaces.htm

    Ideal DIR layout
    Artist Folder \ songtitlewithnospaces.htm

    I have a listing or can create a listing (.txt file) of the songs by the artist, I need a way to search this .txt file for the song name (with no spaces i.e. songwithnospaces.htm) and move the file to the corresponding artist folder.

    I would like to create a .bat file for this as I have 1000+ songs and to search/find & move each song file to the correct artist folder would take more time than I have.

    Any help would be appreciated, thanks.
      My Computer


  2. Posts : 1,036
    Winbdows 7 ultimate x64 | Ubuntu 12.04 x64 LTS
       #2

    Can't say about the batch file but have you looked at MediaMonkey » Free Media Jukebox, Music Manager, CD Ripper & Converter ?
    An excellent app to manage messed up media collection.
      My Computer


  3. Posts : 25
    Windows 7 Ultimate x64
    Thread Starter
       #3

    It's not my media collection that is messed up, well it is somewhat but I've used media monkey in the past and it's ended up making things worse.

    No this is a collection of song chords & tabs (to teach you how to play the song on guitar) and all the files are in .htm or .html format.
      My Computer


  4. Posts : 640
    Windows 7 Ultimate x64
       #4

    Could you upload a text file in the format of,

    Artist Name 1
    songwithnospaces1.htm
    songwithnospaces2.htm

    Artist Name 2
    songwithnospaces3.htm
    songwithnospaces4.htm

    etc....

    Then I could easily create a batch file like,

    xcopy /qv songwithnospaces1.htm .\"Artist Name 1"
    xcopy /qv songwithnospaces2.htm .\"Artist Name 1"
    xcopy /qv songwithnospaces3.htm .\"Artist Name 2"
    xcopy /qv songwithnospaces4.htm .\"Artist Name 2"

    If that looks right to you.
      My Computer


  5. Posts : 25
    Windows 7 Ultimate x64
    Thread Starter
       #5

    Currently still searching for an answer but yes attached are two artist documents with their songs.

    The format of the .txt files isn't exactly like you want as I think I'm on to something along the lines of what I need.

    Using 2 files (Alabama.txt) with Filelist.txt (Dir /b > filelist.txt, from .bat file)

    Current .bat file:
    Code:
    @ECHO OFF
    :: Get Files In The Directory & Output Them Into Filelist.txt
    Dir /b > filelist.txt 
    ::
    Dir /b|find "string" (C:\Artist\Alabama.txt)
    for %%a in (E:\0BACKUP ONLY\DOCS\song lyrics) do move (C:\Artist\)
    pause
    there are no spaces in the file name of the html files is why the songs are they way they are.
    Help Needed with Searching File/Folder/Move .Bat file Attached Files
    Last edited by Gunslinger2; 29 Apr 2012 at 18:42. Reason: added filelist.txt
      My Computer


  6. Posts : 640
    Windows 7 Ultimate x64
       #6

    No attachments, did you click upload after browsing and selecting the files?
    Edit: Files there now

    Does each Artist have their own text file with a list of their files?
    Last edited by Duzzy; 29 Apr 2012 at 21:28.
      My Computer


  7. Posts : 25
    Windows 7 Ultimate x64
    Thread Starter
       #7

    no I'm having to manually create that list & ill be creating the list all the same way
      My Computer


  8. Posts : 640
    Windows 7 Ultimate x64
       #8

    filelist.txt is no good there's no way to determine which file belongs to which artist, except some that have the artist in the title.
    The other two I can work with or creating a list in one file in the format I specified before.
      My Computer


  9. Posts : 25
    Windows 7 Ultimate x64
    Thread Starter
       #9

    that's why I was using 2 files i.e. Alabama.txt to get the songs by them and searching the Filelist.txt for the songs and then moving the .html files to the corresponding artist directory. Just trying to automate the process as much as I can as I have to make each artist song list manually.

    I figure that I'll have to end up making a .bat file for each artist which is fine but I'm unfamiliar with all of the .bat file functions.
      My Computer


  10. Posts : 640
    Windows 7 Ultimate x64
       #10

    Make a backup of the files if you havn't already. Now this isn't perfect but if you can create a list for each artist then this should work
    Code:
    @echo off
    
    rem Copy Files
    for /F "usebackq delims==" %%i in ("D:\Artist\Alabama.txt") do xcopy /qv "%%ilyricschords.*" ".\Alabama\*.*"
    for /F "usebackq delims==" %%i in ("D:\Artist\BillAnderson.txt") do xcopy /qv "%%ilyricschords.*" ".\BillAnderson\*.*"
    
    rem Move Files - requires destination folder to already exist
    md Alabama
    md BillAnderson
    for /F "usebackq delims==" %%i in ("D:\Artist\Alabama.txt") do move "%~dp0%%ilyricschords.html" "%~dp0Alabama\"
    for /F "usebackq delims==" %%i in ("D:\Artist\BillAnderson.txt") do move "%~dp0%%ilyricschords.html" "%~dp0BillAnderson\"
    
    echo.
    pause
    Just put it in the same folder as the files.

    Only use the 2 copy lines or 2 move lines not all 4. I would use the copy lines as there will be less scripting then if all is successful then you can delete the originals.

    Take note the two text files did not contain the extension .html on the file names if any list does then remove .* from "%%ilyricschords.*" for the copy lines or remove .html "%~dp0%%ilyricschords.html" for the move lines.

    I can't see anyway of doing this any easier than manually creating the list files. Using a single list file in the format I specified before would take just as long to create but using find and replace in a good text editor could speed up the batch file creation.

    EDIT: Just looked at your filelist.txt again and noticed all files contain "lyricschords" on the end so I updated the code to work with that.

    EDIT: New and improved code in next post.
    Last edited by Duzzy; 29 Apr 2012 at 21:31. Reason: Updated code
      My Computer


 
Page 1 of 2 12 LastLast

  Related Discussions
Our Sites
Site Links
About Us
Windows 7 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 7" and related materials are trademarks of Microsoft Corp.

© Designer Media Ltd
All times are GMT -5. The time now is 08:23.
Find Us