• Welcome to Overclockers Forums! Join us to reply in threads, receive reduced ads, and to customize your site experience!

Batch command to move files by type?

Overclockers is supported by our readers. When you click a link to make a purchase, we may earn a commission. Learn More.

MadSkillzMan

Member
Joined
Nov 16, 2003
Location
Cleveland OHIO
ok guys. Long time no post. Been in Mac OSX+Linux world the past 5 years so forgive my ignorance.

the task at hand is help a buddy with a crap-ton of songs on a terabyte hard drive. Hes trying to load up his video jukebox. Asked me to weed out the .m4a files that it cant play and convert them (i know, not the smartest but i dont argue)

best i can figure is, write a batch script that locates all the songs with the .m4a extension, and move them from the main directory to another

Sounds easy enough but the problem i cant seem to figure out is how to keep the folder structure. He originally put alot of it together in what looks like iTunes. So itll go Artist->Albun-Track.m4a.

Id like to simply move EVERYTHING thats .m4a and keep that artist->album structure.

Any old DOS gurus out there?
 

Sydney

Member
Joined
Sep 28, 2009
Location
Reykjavík, Iceland
Why not do it through a linux live CD? That's what I did for my friend when I had to save all his songs which were scattered all over his home folder.

cp -r /mnt/Users/Username/*.mp3 /backup

But then again, that will destroy the folder organization. Needs a more complicated script, but I still recommend a live CD over a batch script.
 

dribblesnort

Member
Joined
Nov 29, 2002
Location
USA
Why not try something like the xcopy in DOS?

md m4a
cd m4a
xcopy D:\Music\folder\*.m4a /e /k /i /c


then...

D:
cd\
cd Music
del *.m4a /s <-- run this command AFTER verifying all your m4a files were, in fact, copied to the m4a folder so you don't lose them.
 
OP
M

MadSkillzMan

Member
Joined
Nov 16, 2003
Location
Cleveland OHIO
Sydney, i'd be all about the linux route, but did they ever get writting to NTFS working properly?

Dribble, xcopy was DOS only im reading and doesnt always work...this is on a vista machine...wouldn't the move command be alright? And what does the md command do? i figured id just write the script to go right into the folder
 
OP
M

MadSkillzMan

Member
Joined
Nov 16, 2003
Location
Cleveland OHIO
No kidding! hahaha..i looked into it..god..YEARS ago...i just got back on linux since i blew the PSU up on my Dual G5 working on our album...had no idea that they could handle NTFS now..i remember back in the day, you could write, but you'd have to do a DiskCheck on the next start up to repair the drive or some screwy thing.

And now that i think of it, if i destroys the folder structure its not that big of deal. supposedly all the ID3 tags are there, and i have to find the album art anyways, so i'll just let itunes handle that.
 

4GHZ_or_bust

Now 6GHz or Bust!
Joined
Aug 1, 2002
Location
Michigan
xcopy command +1 if you don't want to mess with other OSes. It's a rather old DOS command and I couldn't find it when I went Vista over a year ago so you may need to find and steal er borrow xcopy.exe from another PC with older OS.

I've used it once to copy everything with ,jpg extension and using /s switch to search all subdirectories and dumped it to a 4GB USB drive. It threw up on me less than half way through C drive because I didn't account that apps and temp files would also get copied but it did get the job done in the end finding me a few lost pictures.
 
OP
M

MadSkillzMan

Member
Joined
Nov 16, 2003
Location
Cleveland OHIO
Apparently in vista the command is RoboCopy. Takes the same switches and options as xcopy. AND someone wrote a GUI front end for it. Yay.
 

dribblesnort

Member
Joined
Nov 29, 2002
Location
USA
Sydney, i'd be all about the linux route, but did they ever get writting to NTFS working properly?

Dribble, xcopy was DOS only im reading and doesnt always work...this is on a vista machine...wouldn't the move command be alright? And what does the md command do? i figured id just write the script to go right into the folder

You did ask for old DOS gurus to answer :salute:

A good Admin always copies, then deletes, rather than move. Takes longer, but you can compare CRCs to ensure no bits dropped.

md makes the directory. cd changes into it. the xcopy from there would copy the files from wherever they are located (the path example) to the current working directory. (the one you used cd to go to)

That would have put all the files you wanted into the separate directory like you asked.

Glad to hear you found a different, easier way to accomplish it though.
 
OP
M

MadSkillzMan

Member
Joined
Nov 16, 2003
Location
Cleveland OHIO
Dribblesnort,

IT WORKED!

perfectly..

Too perfectly...i cant seem to find a bulk .m4a to mp3 converter, that retains the ID3 tags, AND will let me basically enter an entire harddrive worth of m4a's at once

So if theres a variation of xcopy that can move ONLY .m4a files (mind you i found them and separated them already) but that will take all the .m4a files out of their directory structure and place them into ONE folder, that would be..friggen awesome

I'm open to UNIX commands as well as i'm going to take a linuxLiveCD with me tomorrow. Wonder if a liveCD has the massive converter...?

Its a quad core or dualcore withh HT x64 system, so it goes kinda quick

thanks a ton guys