I'm in desperate need of a batch file to cut and paste files..
I have a sequence of over 5000 images in one folder.
(ie: image_0001.jpg, image_0002.jpg, etc)
And I'd like to be able to move every 48th image to its own folder, in another directory.
Is something like this possible?
Thanks for any help.
Jeff
Move incremental files?
Moderator: DosItHelp
Re: Move incremental files?
This might work (untested):
Code: Select all
@echo off
setlocal enabledelayedexpansion
md temp1
for /f "delims=" %%a in ('dir /b image*.jpg') do (
set /a c=c+1
if !c! EQU 48 (
move "%%a" temp1
set c=0)
)
Last edited by foxidrive on 09 Jul 2012 08:39, edited 1 time in total.
Re: Move incremental files?
Thanks Foxdrive!
May I ask how to include the path directories? Or do I run it from the root directory?
Asuming my source folder is D:\Tests
and destination folder is D:\Tests\Finals
Sorry, I should have mentioned I'm a complete noob.
Thanks again for the reply!
Jeff
May I ask how to include the path directories? Or do I run it from the root directory?
Asuming my source folder is D:\Tests
and destination folder is D:\Tests\Finals
Sorry, I should have mentioned I'm a complete noob.
Thanks again for the reply!
Jeff
Re: Move incremental files?
Put it in the folder with the images. It will create a temp1 folder with the 48th series of images, with any luck.
Re: Move incremental files?
Or use this. Note that I edited the above version to correct an error.
Code: Select all
@echo off
pushd "d:\tests" && (
setlocal enabledelayedexpansion
md Finals 2>nul
for /f "delims=" %%a in ('dir /b image*.jpg') do (
set /a c=c+1
if !c! EQU 48 (
move "%%a" Finals
set c=0)
)
)
Re: Move incremental files?
Thanks Foxdrive!
Your latest code worked exactly how I described..
thanks again!!
Jeff
Your latest code worked exactly how I described..
thanks again!!
Jeff