Windows 7 Forums
Welcome to Windows 7 Forums. Our forum is dedicated to helping you find support and solutions for any problems regarding your Windows 7 PC be it Dell, HP, Acer, Asus or a custom build. We also provide an extensive Windows 7 tutorial section that covers a wide range of tips and tricks.


Windows 7: Help Needed with Searching File/Folder/Move .Bat file


29 Apr 2012   #1

Windows 7 Ultimate x64
 
 
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 System SpecsSystem Spec
.

29 Apr 2012   #2

Winbdows 7 ultimate x64 | Ubuntu 12.04 x64 LTS
 
 

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 System SpecsSystem Spec
29 Apr 2012   #3

Windows 7 Ultimate x64
 
 

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 System SpecsSystem Spec
.


29 Apr 2012   #4

Windows 7 Ultimate x64
 
 

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 System SpecsSystem Spec
29 Apr 2012   #5

Windows 7 Ultimate x64
 
 

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.


Attached Files
File Type: txt filelist.txt (242.7 KB, 26 views)
File Type: txt Alabama.txt (563 Bytes, 14 views)
File Type: txt BillAnderson.txt (748 Bytes, 9 views)
My System SpecsSystem Spec
29 Apr 2012   #6

Windows 7 Ultimate x64
 
 

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?
My System SpecsSystem Spec
29 Apr 2012   #7

Windows 7 Ultimate x64
 
 

no I'm having to manually create that list & ill be creating the list all the same way
My System SpecsSystem Spec
29 Apr 2012   #8

Windows 7 Ultimate x64
 
 

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 System SpecsSystem Spec
29 Apr 2012   #9

Windows 7 Ultimate x64
 
 

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 System SpecsSystem Spec
29 Apr 2012   #10

Windows 7 Ultimate x64
 
 

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.
My System SpecsSystem Spec
Reply

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




Thread Tools



Similar help and support threads for2: Help Needed with Searching File/Folder/Move .Bat file
Thread Forum
Change folder/file location - use Move, Symbolic link or Junction? General Discussion
Can't rename, delete or move folder or file BSOD Help and Support
Solved How do I move the Libraries folder location in File Explorer? General Discussion
Batch file to move (many) duplicted folder contents - Help!! General Discussion
Solved how to move file in folder Customization
BSOD while 'Move File to Folder' option BSOD Help and Support

Our Sites

Site Links

About Us

Find 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 06:43 AM.
Twitter Facebook Google+



Windows 7 Forums

Seven Forums Android App Seven Forums IOS App
  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33