batch script to randomly copy 4gb of files

Microsoft Windows xp professional w/serv...
January 9, 2011 at 22:47:16
Specs: Windows 7, Windows XP, Windows 2003, Windows 2008, Vista
Hello-

I have an older MP3 player which only recognizes files in a single directory. I'd like to create a batch job that randomly parses files out of my iTunes folder and puts them all into a single folder not to exceed 4GB. What I want to do is then put it as a scheduled task to run daily so I have a unique set of files every week. I also need it to truncate the files to 20 or less characters, remove _ and spaces. Is this possible?

Thank You!


See More: batch script to randomly copy 4gb of files

Report •

#1
January 10, 2011 at 00:52:38
This is rough but the best I care to do right now.

===============================================
@echo off > MP3list & setLocal EnableDELAYedeXpansion

for /f "tokens=* delims= " %%a in ('dir/b/s/a-d x:\a*.mp3') do (
echo !random! %%a
) >> MP3list

set S=
for /f "tokens=1* delims= " %%a in ('sort ^< MP3list') do (
set Z=%%~Zb
set Z=!Z:~0,-6!
set /a S+=Z
if !S! geq 4000 goto :full
echo total is !S!MB so copy %%b
)
:full


=====================================
Life is too important to be taken seriously.

M2


Report •

#2
January 18, 2011 at 04:49:24
That works pretty well! Is there a way to strip all non A-Z and a-z characters from a file in batch without specifying every single possible character to include?

Thank You!


Report •

#3
January 19, 2011 at 01:26:03
Strip chars from files or FILE NAMES? Not the same thing.


=====================================
Life is too important to be taken seriously.

M2


Report •

Related Solutions

#4
January 19, 2011 at 10:40:45
File Names is what I meant. Thanks

Report •

#5
January 19, 2011 at 12:12:20
Post a few file names.


=====================================
Life is too important to be taken seriously.

M2


Report •

#6
January 19, 2011 at 16:05:06
03 My First Kiss (feat. Ke$ha).mp3
01 Ten Seconds Before Sunrise Tiƫsto (rmx).mp3
running away.mp3

Report •

#7
January 20, 2011 at 00:44:21
I worked on this for a while and got nowhere. I recommend a new thread with a title like: batch: strip all non a-z chars.

Maybe it will get the attention of one of the rocket scientists here.


=====================================
Life is too important to be taken seriously.

M2


Report •

Ask Question