I understand that there are tons of questions on this site regarding the creation of a batch file that goes through the file in a specified folder and deletes them if it satisfies the condition stated.
However, I would like to tweak that a little bit. In my batch file, I would like to look at a folder, say C:\Dev and get all the files that are within the same month. After getting all those files, I want to sort through all the dates and delete everything except for the latest one. So if I have 5 files for January on that folder with dates January 1, 12, 20, 27, and 30, I would only keep the file dated January 30th and delete all the others.
Is this possible?
< lang-dos -->
#ECHO OFF
SETLOCAL
SET "targetdir=c:\sourcedir"
SET "pfname="
PUSHD "%targetdir%"
FOR /f "delims=" %%a IN ('dir /b /a-d /o:d "*" ') DO (
SET "fname=%%a"
SET "fdate=%%~ta"
CALL :process
)
POPD
GOTO :EOF
:process
:: reformat date - this depends on yout local date-format.
:: YY(YY)MM required - my format is dd/mm/yyyy
SET fdate=%fdate:~6,4%%fdate:~3,2%
IF NOT DEFINED pfname GOTO nodel
IF %fdate%==%pfdate% ECHO DEL "%targetdir%\%pfname%"
:nodel
SET pfdate=%fdate%
SET "pfname=%fname%"
GOTO :eof
This should work for you. The required DEL commands are merely ECHOed for testing purposes. After you've verified that the commands are correct, change ECHO DEL to DEL to actually delete the files.
First, the target directory is set up and pfname is cleared.
The PUSHD changes the current directory until the POPD is executed
the dir command outputs filenames only (/b), no directory names (/a-d) in date-order (/o:d). Each line sets fname to the filename and fdate to the filedate.
within :process, the date-string is manipulated. I don't know which format you use, but the basic formula is %variable:~startposition,length% where startposition starts at 0=first character. The idea is to have fdate in the format yyyymm
if pfname (previos filename) is not set, this is the first file found, so we don't delete that.
For every other file, if the filedate is the same as the previous filedate, then delete the previous filename.
The current filename/date is then recorded as the previous version.
Done!
Related
Not sure this is possible with only a batch file.
I have a file named BaseFile.7z location is E:\Backup\C Drive Zip\BaseFile.7z
Is it possible to create a batch command that renames the file with its creation date? For example BaseFile - 02-19-2015.7z
I currently have a command that renames the file with the current date which I pasted below for reference, but thats not exactly what I'm looking for. I need creation date.
RENAME "E:\Backup\C Drive Zip\Jaipur.txt" "BaseFile - %date:/=-%.txt"
#ECHO OFF
SETLOCAL
SET "filename=U:\sourcedir\zzz.zzz"
IF NOT EXIST "%filename%" ECHO "%filename%" NOT found&GOTO :eof
SET "datepart="
FOR /f "tokens=1-3delims=/-:" %%a IN ('dir /tc "%filename%"') DO IF "%%c" neq "" SET "datepart=%%a-%%b-%%c"
FOR /f %%a IN ("%filename%") DO FOR /f %%d IN ("%datepart%") DO ECHO(REN "%%a" - "%%~na %%d%%~xa"
GOTO :EOF
The required REN command is merely ECHOed for testing purposes. After you've verified that the command is correct, change ECHO(REN to REN to actually rename the file.
Note that there is general sloppiness in the use of date-references. There are three dates on each file - actual create date (use /tc), last access (/ta) and last-written (/tw).
The process locates the file, then reads a dir listing with the appropriate date selected. The only or last line in the listing that will contain a third non-empty token is the date/time of the file in question, so datepart will acquire yyyy-mm-dd hh
the for/f %%a then applies the full filename to %%a ready for partitionig into its components and the for/f %%d assigns the first token from datepart (ie up to the space) into %%d.
Bang the components together, and the resut is reported...
I have a folder that gets a new file added everyday to the folder with the same file name but incremental extension such as .001, .002, .003, etc. However, if there's no file within the folder it starts at .001 again.
The problem is they are all named the same and if I move them to another folder to archive them it would just overwrite the same file over and over again. I could create a folder each day with the date with only one file in it, but that seems a bit redundant.
Is there a way to look at the create date of each file and rename it to the create date?
I've gotten this far, but it looks like for this situation I have to use a static file name, how to loop through the entire directory?
SET filename = C:\test.001
FOR %%f IN (%filename%) DO SET filedatetime=%%~tf
rename c:\test.001 C:\test_%filedatetime%.txt
move C:\*.txt C:\archive\
this provides the correct sort order:
#echo off &setlocal disableDelayedExpansion
set "startfolder=%userprofile%\test"
cd /d "%startfolder%"
for %%a in (*) do (
for /f "delims=." %%b in ('wmic datafile where "name='%startfolder:\=\\%\\%%~a'" get lastmodified^|find "."') do (
echo(ren "%startfolder%\%%~a" "%%~b.txt"
)
)
Remove echo to get it working.
#ECHO OFF
SETLOCAL ENABLEDELAYEDEXPANSION
SET "targetdir=c:\sourcedir"
SET "destdir=c:\destdir"
PUSHD "%targetdir%"
FOR %%a IN (*.*) DO (
SET "timestamp=%%~ta"
SET "timestamp=!timestamp:/=_!
SET "timestamp=!timestamp::=_!
SET "timestamp=!timestamp:.=_!
SET "timestamp=!timestamp:,=_!
SET "timestamp=!timestamp: =_!
ECHO MOVE "%%a" "%destdir%\%%~na.!timestamp!"
)
GOTO :EOF
This should work with any file in the nominated target directory where the name does not include ! or ^.
The required MOVE commands are merely ECHOed for testing purposes. After you've verified that the commands are correct, change ECHO MOVE to MOVE to actually move the files. Append >nul to suppress report messages (eg. 1 file moved)
The gymnastics around timestamp are intende to replace /: with _ since these are illegal filename characters. Space., are similarly replaced - they're legal but often painful.
If you want the destination filename to be name.003.timestamp, remove the ~na from the destination name.
Try like this :
SET $path=The_path_who_contain_the_FILES
FOR /F "DELIMS=" %%f IN ('dir "%$path%" /a-d/b') DO (
SET filedatetime=%%~tf
move "%%~dpnxf" "C:\archive\test_%filedatetime%.txt")
First of all, I am completely newbie here in batch file scripting and willing to learn it.
Let's say that I have a bunch of files in a folder with file extension/file-ext: ext1, ext2, and ext3.
every single file has incrementation such as:
filename.file-ext.1
filename.file-ext.2
filename.file-ext.3
...
filename.file-ext.x
The main target is to backup the old increments(from 1 to x-1), then backup them in a new folder, and then change the last increment "x" to "1".
Any kind of help from you would be highly appreciated.
The main problem when file names contain numbers is that they appear in alphabetic, not numeric, order. For example:
filename.file-ext.1
filename.file-ext.10
filename.file-ext.11
filename.file-ext.12
filename.file-ext.2
filename.file-ext.3
filename.file-ext.4
filename.file-ext.5
filename.file-ext.6
filename.file-ext.7
filename.file-ext.8
filename.file-ext.9
The last file in previous list should be 12, but the last name given by for or dir commands is 9. The Batch file below uses a two-pass approach: it first review the whole list and get the real last numeric file, then it process the list again and backup all files excepting the last one.
#echo off
setlocal EnableDelayedExpansion
rem First pass: Get the last numeric file
set last=0
for %%a in (filename.ext.*) do (
set num=%%~Xa
if !num:~1! gtr !last! set last=!num:~1!
)
rem Second pass: Backup all files excepting the last one
for %%a in (filename.ext.*) do (
if %%a neq filename.ext.%last% move %%a \backupDir
)
rem Rename the last file, if it is not 1
if %last% gtr 1 ren filename.ext.%last% filename.ext.1
The program above was written as simplest and clearest as possible. You must insert some quotes if file names may have spaces.
#ECHO OFF
SETLOCAL
SET filename=FILENAME
SET fileext=FILE-EXT
SET "deedpoll="
FOR /f "delims=" %%i IN ('dir /b /a-d /o:-d "%filename%.%fileext%*"') DO (
IF DEFINED deedpoll ECHO MOVE "%%i" "\newdir\" >nul
IF NOT DEFINED deedpoll SET "deedpoll=%%i"
)
IF DEFINED deedpoll ECHO REN "%deedpoll%" "%filename%.%fileext% 1"
since we have no clue as to the real filename or file extension involved, we can only assume that they will be simple alphamerics and spaces. I've also assumed that your destination directory exists and that your current directory is the one containing your fileset.
And I've assumed that your sequencing will work on DATE - it's the NEWEST file that does NOT get backed up (moved to newdir) and renamed ...1
It's quite simple. First clear deedpoll then perform a dir listing of the /b bare filename, /a-d with no directorynames /o:-d in reverse-order of date.
The first filename assigned to %%i will thus be the newest. deedpoll is not yet set, so the move is not executed, and then deedpoll is assigned the name of the newest file.
Since deedpoll is now set (or defined) then the move will be done for each of the other filenames matching the supplied mask.
finally, deedpoll is renamed to version 1.
Note that the REName and MOVE commands are merely ECHOed to the screen. This is to allow you to ensure that the batch would do what you want it to do. If all is correct, remove both of these ECHO keywords to activate the rename and move.
Ok let me explaned it again
I have two location :
F:\Reporting\02.2013 in the folder "02.2013" I have below files
Balance Sheet_20130228_045485.xls 3/22/2013 2:40 PM
Balance Sheet_20130228_024867.xls 3/23/2013 1:40 PM
Balance Sheet_20130228_023556.xls 3/23/2013 3:50 PM
F:\Statements\02.2013 in the folder "02.2013" I have below files
FS_20130228_045485.xls 3/22/2013 4:40 PM
FS_20130228_024867.xls 3/23/2013 1:40 PM
FS_20130228_023556.xls 3/23/2013 6:45 PM
First I wants to moov the latest modified files from both the folder to Target folder :
Target folder is F:\accounting\02.2013
Then I wants to rename those files as
Balance Sheet_20130228_023556.doc as BalanceMTD.xls
FS_20130228_045485.doc as FS.xls
note: I have to do this activity every month,
so folder location will be change like F:\Reporting\03.2013
and file name also will be change like FS_20130331_045465.doc 4/27/2013 4:30 PM
Can you please suggest me any batch file which can help me to do this.
I'll change the date every month if required before execute it.
This will move and rename the newest file from each of your source directories:
#echo off
setlocal
set DateFolder=02.2013
set TargetFolder=F:\Accounting\%DateFolder%
:: Move the newest file from Reporting and rename it to BalanceMTD.xls
call :MoveAndRename "F:\Accounting\%DateFolder%" "%TargetFolder%\BalanceMTD.xls"
:: Move the newest file from Statements and rename it to FS.xls
call :MoveAndRename "F:\Statements\%DateFolder%" "%TargetFolder%\FS.xls"
:: Done
goto :eof
:MoveAndRename
set SourceFolder=%~1
set TargetFile=%~2
:: Find the newest file in the source folder
for /f "tokens=*" %%F in ('dir /b /od /a-d "%SourceFolder%"') do set "NewestFile=%%F"
:: Move and rename it to the target
move "%SourceFolder%\%NewestFile%" "%TargetFile%"
:: Done with this subroutine
goto :eof
I've put the bulk of the working code in a "subroutine" named MoveAndRename, which simply finds the newest file in a particular folder (using a for /f loop over a dir /a-d to loop over all files in order of date, remembering only the last one), then a move to move and rename it to the target. (If you want to keep the original file, then do copy instead.)
The top part of the batch file then just calls the MoveAndRename subroutine multiple times, once for each source folder you want to look at.
If you want to avoid editing the batch file every month, change the third line to this:
set DateFolder=%1
and pass the date to the batch file as an argument: MonthlyProcess.bat 02.2013. Or you can set DateFolder using the %date% environment variable, but since it is formatted based on your locale settings, and it is well documented elsewhere, I will leave that as an exercise for you.
#echo off
setlocal EnableDelayedExpansion
cd F:\MY DOCUMENTS\zyx
rem Process all file names
for /F "delims=" %%a in ('dir /B *.xls') do (
rem Get base name before first underscore (ie: "Balance Sheet" or "FS")
for /F "delims=_" %%b in ("%%a") do (
rem Check if name have two words (ie: "Balance"/"Sheet" or "IC"/"Activities")
for /F "tokens=1,2" %%c in ("%%b") do (
rem If base name have just one word...
if "%%d" equ "" (
rem New name is that word (ie: "FS")
set newName=%%c
) else (
rem We don't know what goes here!
)
)
)
ren "%%a" "!newName!.xls"
)
We could complete previous program if you give us details on how to do so...
EDIT 1
STEP 1:
The telephonic conversations are recorded in .WAV format in specific folder and sub-folders (created AUTOMATICALLY by the the voice recording software in the current date format, i.e., 20121119 (YYYYMMDD). This naming convention cannot be changed. Current date sub-folders are automatically created in D Drive in the folder called RECFILED. Say, if the recordings are for today, the files would be stored in 20121119 sub-folder. Yesterday's files were stored in 20121118.
STEP 2:
At the end of the day, these *.WAV files needs to be converted to *.MP3 format and to be uploaded to Amazon S3. At present this process is manual. Since, there are lot many WAV files, so I use SOX to batch convert the WAV to MP3. For this purpose, I have created a batch file (explained in my original question) so that this conversion process can be automated. This batch file converts the WAV to MP3 and saves the MP3 files in same folder as of the WAV files. For this, what I have to do is to copy the batch file in the folder and run it. It converts the files and save it in the same folder.
STEP 3: Once the files are converted. Then on Amazon S3, in a specific bucket, I have to create a new folder with current date so that all these MP3's can be stored there. BUT, the date format here is DD.MM.YYYY. The folder hierarchy is \BucketName\Voice\201211\19.11.2012\*.MP3 (for today), \BucketName\Voice\201211\20.11.2012\*.MP3 (for tomorrow) and so on.
Now, the problem is:
Traverse to the latest folder (looking in to d:\RecFileD\YYYYMMDD) and see if there are WAV files available in the folder. If yes, the convert these files to MP3 and store them in the folder called DD.MM.YYYY on local server on any specific location. (today's date but with a different format).
Once, the folder is created (with DD.MM.YYYY naming convention. The same folders needs to be uploaded on S3 in a specific month (i.e., 201211). And once the month changes, say December, the files related to December month would go in the folder 201212 and so on.
The problem here is that on local server the naming convention is YYYYMMDD (without spaces, dot or comma) and on S3 the naming convention is DD.MM.YYYY (with dots).
ORIGINAL QUESTION
Please help me write a batch file so that I can automate the process of conversion of WAV files to MP3 and then uploading them directly to Amazon S3 to specific folders. Right now it is a manual process.
Actually, we are running a small call centre and all the voice calls are recorded and saved on the server in D: drive in folder named RecFileD and sub-folders named with the current date (i.e., 20121117, 20121116 and so on). The files are saved in WAV format by default. I need to convert the files to MP3 before uploading them to Amazon S3 for storage.
The requirement is that I need to upload the MP3 files daily on the S3 on a specific time at the end of the day. The problem is how to traverse to the last folder (current date folder) and convert the files. On local server the voice files are saved in d:\RecFileD\20121117\*.wav and on Amazon S3 the files are uploaded in folders:
\BucketName\Voice\201211\17.11.2012\*.mp3 (this is for November month);
\bucketName\Voice\201212\01.12.2012\*.mp3 (this would be for Dec month) (31 folders for all days).
To automate the conversion, I have created the below batch file. This file uses the SOX application to convert the WAV files to MP3 in the current folder.
#echo off
call :treeprocess
goto :eof
:treeprocess
for %%f in (*.wav) do
(
sox %%~nf.WAV %%~nf.mp3
sox %%~nf.WAV %%~nf-short.mp3 trim 0:30 1:00
)
for /D %%d in (*) do
(
cd %%d
call :treeprocess
cd ..
)
exit /b
To automate the uploading of files to S3, I'd be using S3 command line tool.
In brief, following steps are required:
Traverse to the current date folder only (20121115, 20121116, 20121117 etc.) on local server and convert the WAV files to MP3 (using the above script).
Move those MP3 files to the separate folder created automatically named as 17.11.2012 (as per current date).
Upload the folder to Amazon S3 on specific location. i.e., \bucketname\voice\201211\17.11.2012.
Wow! This sound much more complex than really is!
#echo off
rem Create folder names from current date, MM/DD/YYYY locale format is assumed
for /F "tokens=1-3 delims=/" %%a in ("%date%") do (
set YYYYMMDD=%%c%%a%%b
set YYYYMM=%%c%%a
set DD.MM.YYYY=%%b.%%a.%%c
)
rem Enter into target folder
cd /D D:\RecFileD\%YYYYMMDD%
rem Convert WAV files to MP3 using SOX
for %%f in (*.wav) do (
sox %%~nf.WAV %%~nf.mp3
sox %%~nf.WAV %%~nf-short.mp3 trim 0:30 1:00
)
rem Move MP3 files to brother folder
md ..\%DD.MM.YYYY%
move *.mp3 ..\%DD.MM.YYYY%
rem Upload the folder to Amazon S3
echo S3COPY from ..\%DD.MM.YYYY% to \bucketname\voice\%YYYYMM%\%DD.MM.YYYY%
I suggest you to be as concise as possible when describing your problem, but don't forget any details. Por example, in your (long) description, the local folder named 17.11.2012 is not enough explained!
I hope this is what you wanted...
Antonio
What you have is pretty good, you're pretty close.
The environment I was testing on required do ( to have the open paren on the same line as the do. Your formatting with a newline in the middle may be causing a problem.
What you're totally missing is any parsing of the directory name which is expected to be YYYYMMDD. You can do that with:
set dirname=%%d
set year=%dirname:~0,4%
set month=%dirname:~4,2%
set day=%dirname:~6,2%
Once your done this it's easy to create file names and paths based on YYYY, MM, DD:
set s3path=!file_year!!file_month!\!file_day!.!file_month!.!file_year!
will generate a path like YYYYMM\DD.MM.YYYY.
You can get the 'last' dir using:
for /f "tokens=1" %%a IN ('dir /b /a:d /o:n ????????') do (
set dirset=%%a
)
Note: this is only implemented in the second solution. Let's break this down:
dir /b /a:d /o:n ????????
Does a directory in 'bare' format (just the list of matching files, one per line), with attribute directory (only list directories), orders by name (this is the default on NTFS but not on FAT so best to specify sort order), matching ????????, any 8 characters (because the directories are expected to be named like YYYYMMDD so always 8 characters). This returns an ordered list of 8 character directory names.
for /f "tokens=1" %%a IN ('command') do echo %%a
Executes the command and parses the results, line by line. Here the first token of each result will be echoed.
for /f "tokens=1" %%a IN ('dir /b /a:d /o:n ????????') do (
set dirset=%%a
)
We put it all together and see that dirset will be set to each matching directory name. But after the for loop finishes it will be left set to the last value, or 'latest' directory.
In the code below I have dirname set separately to avoid problems with variable expansion rules. Alternatively, you should be able to use:
setlocal enableextensions enabledelayedexpansion
set dirname=%%d
set year=!dirname:~0,4!
You problem, as stated, does not require recursion. My code just iterates each dir, then iterates each file. If the file layout is less structured then you indicate, then recursion may be needed.
You didn't specify which Windows S3 command line tool you use so I echo *S3COPY* with local full path and partial path. You should be able to replace this with your copy command.
You'll need to run this from d:\RecFileD or you could add this near the top of the bat file:
d:
cd \RecFileD
You'll probably need to change s3root to the actual root dir of your local S3 copy. Instead of moving the files, I have sox create them in the correct location.
I set year, month, day vars in processfiles because setting them in processdirs is complicated by variable expansion rules.
If you're doing much more than this, I'd recommend looking into Python. It's got a great community / eco-system, is easy to get started with and is free. Plus you don't wind up spending all your time fighting with the language.
Here's my first try:
#echo off
setlocal
set s3root=d:\s3\bucket\voice
call :processdirs
goto :eof
:processfiles
set year=%dirname:~0,4%
set month=%dirname:~4,2%
set day=%dirname:~6,2%
set s3path=%year%%month%\%day%.%month%.%year%
set s3dir=%s3root%\%s3path%
if not exist "%s3dir%" md "%s3dir%"
for %%f in (*.wav) do (
sox "%%~nf.WAV" "%s3dir%\%%~nf.mp3"
sox "%%~nf.WAV" "%s3dir%\%%~nf-short.mp3" trim 0:30 1:00
)
echo *S3COPY* %s3dir% %s3path%
goto :eof
:processdirs
for /D %%d in (*) do (
set dirname=%%d
cd "%%d"
call :processfiles
cd ..
)
goto :eof
#Aacini answer made me realize, unfortunately my solution is lacking. It doesn't process only today's files. But I'm concerned with what happens when a day is skipped.
I added two parameters to control what is processed. The first parameter specifies a named filter and can be one of:
newlatest - new files in latest directory, based on filename (default)
latest - all files in latest directory, based on filename
today - today's directory
newdirs - all dirs (missing dates) that don't exist in the S3 tree
newfiles - all files that don't exist in the S3 tree
all - all files (used to overwrite corruption in S3 tree)
If the filter is newdirs, newfiles or all, then a second parameter can be used to further filter on directory name. You can use the * and ? wildcard characters to match a set of files.
If you save the script as ProcDirs.bat then here are some examples:
ProcDirs all 20121119
Will force the processing (or reprocessing) of the specified dir.
ProcDirs newdirs 201211??
Will process new directories (missing from output tree) that match the dir name (any day of the specified year and month).
ProcDirs newfiles 2012????
Will process new files (missing from output tree) in directories that match the dir name (any day of the specified year).
ProcDirs
ProcDirs newlatest
Are the exact same because newlatest is the default. This will process new files in the (lexically) 'latest' directory
The code is more complicated, but not too bad. I did try to use #Aacini's code to get today's month/day/year but it didn't work on my system (because my date format must be different than required). So I'm using a different approach that doesn't depend on local date formats.
My first solution didn't require delayed expansion but this one does so I turn it on with setlocal (works on Win XP but maybe not older Windows) and use ! instead of % for environment variable substitution.
#echo off
setlocal enableextensions enabledelayedexpansion
set s3root=d:\s3\bucket\voice
rem Set the default filter mode
set newfilter=none
set dirsetfilter=none
set arg=%1
if "!arg!" == "" set arg=newlatest
if "!arg!" == "newdirs" (
set newfilter=newdirs
) else if "!arg!" == "newfiles" (
set newfilter=newfiles
) else if "!arg!" == "all" (
set dirsetfilter=none
set newfilter=none
) else if "!arg!" == "today" (
set dirsetfilter=today
) else if "!arg!" == "latest" (
set dirsetfilter=latest
) else if "!arg!" == "newlatest" (
set newfilter=newfiles
set dirsetfilter=latest
)
if !dirsetfilter! == today (
for /f "skip=1 tokens=1-3" %%a IN ('wmic path Win32_LocalTime Get Day^,Month^,Year /Format:table') do (
if %%a GTR 0 (
set now_day=%%a
set now_month=%%b
set now_year=%%c
)
)
set dirset=!now_year!!now_month!!now_day!
if not "%2" == "" echo Second parameter, dirset, ignored when filter is today
) else if !dirsetfilter! == latest (
rem pull out the name of the 'last' directory
for /f "tokens=1" %%a IN ('dir /b /a:d /o:n ????????') do (
set dirset=%%a
)
if not "%2" == "" echo Second parameter, dirset, ignored when filter is latest
) else if not "%2" == "" (
rem The second parameter is dirset. Wild card chars, *? allowed
rem only matched dir(s) processed
set dirset=%2
) else (
rem process all dirs that match filter
set dirset=*
)
call :processdirs
goto :eof
:processfiles
set file_year=!dirname:~0,4!
set file_month=!dirname:~4,2!
set file_day=!dirname:~6,2!
set s3path=!file_year!!file_month!\!file_day!.!file_month!.!file_year!
set s3dir=!s3root!\!s3path!
set skipdir=FALSE
if not exist "!s3dir!" (
md "!s3dir!"
) else (
if newdirs == !newfilter! set skipdir=TRUE
)
if !skipdir! == FALSE (
set havenewfiles=FALSE
for %%f in (*.wav) do (
set skipfile=FALSE
if newfiles==!newfilter! if exist "!s3dir!\%%~nf.mp3" set skipfile=TRUE
if !skipfile! == FALSE (
set havenewfiles=TRUE
echo sox "%%~nf.WAV" "!s3dir!\%%~nf.mp3"
sox "%%~nf.WAV" "!s3dir!\%%~nf.mp3"
)
set skipfile=FALSE
if newfiles == !newfilter! if exist "!s3dir!\%%~nf-short.mp3" set skipfile=TRUE
if !skipfile! == FALSE (
set havenewfiles=TRUE
echo sox "%%~nf.WAV" "!s3dir!\%%~nf-short.mp3" trim 0:30 1:00
sox "%%~nf.WAV" "!s3dir!\%%~nf-short.mp3" trim 0:30 1:00
)
)
if !havenewfiles! == TRUE (
echo *S3COPY* !s3dir! !s3path!
)
)
goto :eof
:processdirs
for /D %%d in (!dirset!) do (
echo Process Dir: %%d
set dirname=%%d
cd "%%d"
call :processfiles
cd ..
)
goto :eof
Good luck. I hope this helps.