# Batch file - Only move certain files



## equama (Dec 19, 2003)

Hi.. i have a directory containing files d0000001.001 through d0350000.001. Many of the files have multiple file extensions... for example pages 1-3 for file number one would be d0000001.001, d00000001.002, d00000001.003, etc.

I want to see if there is a way in a batch file that I can say move d0000001.* through d0004250.* into a different folder. Then move d0004251.* through d0005900.* into a different folder, etc. etc.

Anyone know of way I can do this? I know I can do move d00000*.*, d0001*.*, d0002*.*, d0003*.*, but I have an experienced person on the user end.

I would like to ask through the batch file for a beginning and ending number fand have the files moved based on those numbers.

Hope this helps... thanks!

Brian - Equama


----------



## top_gizmo (Jun 28, 2003)

Not batch, but if you are using a windows based system you can do it with Autoit from http://www.hiddensoft.com it is freeware. I would suggest using version 2.64

Autoit will allow you to assign variables and incrament them. You can then use loops with counters to get the job done. You can also have it prompt for input and use that as a variable.

Happy codeing....


----------



## zephyr (Nov 6, 2003)

You should also explore the possibility of using Agent ransack  for your purpose. It will not fit into a batch file but it can separate your files for quick manual manipulation based on your criteria.

I created some files to run a demo for you:


----------



## mole (Aug 24, 1999)

What about a for loop:

for %%a in (d0004251 d0004252 d0004253 d0004254 d0004255 d0004256 d0004257 d0004258 d0004259 d000426* d000427* d000428* d000429* d00050* d00051* d00052* d00053* d00054* d00055* d00056* d00057* d00058* d0005900) do copy %%a c:\mydir\*.*

(Above all on one line in a batch or use a single % for straight from a command prompt.)

You can string for loops together, use commands other than "copy" such as "xcopy" or process a list with the /f switch for "for" if you are using a command prompt from a WinNT/2K/XP computer.

For ideas and tips with batch/command line things, see:

http://www.robvanderwoude.com/

...or type {command} /?


----------

