Solved Batch file move samename.xxx

February 26, 2011 at 23:02:42
Specs: Windows 7
I want to move files from one large folder to separate folders. The large folder has files setup as such:

samename.cdg
samename.mp3
samenam.cdg
samenam.mp3
samena.cdg
samena.mp3

The new created folder(s) need to be named after the two same named files just moved. The reason for doing so is I need to .zip the same named files together. So the only way to seem to do that in batch form is isolate them into their own folders. If there is way to do this without moving them that would be nice to know as well.

Thanks in advance for any assistance.

-Steve


See More: Batch file move samename.xxx

Report •

✔ Best Answer
March 3, 2011 at 22:55:57
Remove the echo in front of pkzip.


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

M2



#1
February 26, 2011 at 23:51:08
:: ==========================================
::
:: loomis.bat Sun 27-02-2011 14:13:32.62
@echo off & setLocal enableDELAYedeXpansion

for /f "tokens=* delims= " %%a in ('dir/b *.cdg *.mp3') do (
echo pkzip -m %%~Na %%a
)


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

M2


Report •

#2
March 1, 2011 at 07:01:33
Thank for you quick response. I am once again left scratching my head. Can you break this code down and tell me how it works. I was able to figure out the last code you gave me (another post) and I tinkered with this one twice the amount I did with the other and still at am loss.

Thnaks,

-Steve


Report •

#3
March 2, 2011 at 06:56:47
Post your code.


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

M2


Report •

Related Solutions

#4
March 2, 2011 at 14:28:08
@echo off & setLocal enableDELAYedeXpansion

for /f "tokens=* delims= " %%a in ('dir/b *.cdg *.mp3') do (
echo pkzip -m %%~Na %%a
)


Report •

#5
March 2, 2011 at 14:29:19
Sorry I didn't know what to do with it ....

Report •

#6
March 2, 2011 at 21:15:29
Put it where your files are and run it.


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

M2


Report •

#7
March 3, 2011 at 10:28:25
Well after realizing I did not have PKZIP on my system I took care of that. The only thing I changed in the script was "pkzip" to "pkzipc" as that is the CL version for Pkwares pkzip. After placing the batch in the correct folder and running it, it just echoed the files like this:

pkzipc -m 0011 0011.cdg
pkzipc -m 0022 0022.cdg
pkzipc -m 0011 0011.mp3
pkzipc -m 0022 0022.mp3

It did not compress, move or create any folders.

In reality I just need to zip the first two files, then the next and so on and so on.


Report •

#8
March 3, 2011 at 10:30:48
I meant the NEXT two and so on & so on ....

Report •

#9
March 3, 2011 at 22:55:57
✔ Best Answer
Remove the echo in front of pkzip.


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

M2


Report •

#10
March 5, 2011 at 00:50:06
Okay seems to be working how ever it does not handle files with exclamations or accented letters. Any way to solve this?

Report •

#11
March 5, 2011 at 02:10:30
Oh and listen thank you very much for your help ....

Report •

Ask Question