There's no such thing as a stupid question, but they're the easiest to answer.
JoinTour
Login
 
Tag Cloud
access audio avg avg 8 bios blue screen boot bsod computer connection cpu crash css dell desktop dma driver drivers dvd email error excel explorer firefox firefox 3 freeze gimp graphics hard drive hardware hijackthis hjt install internet internet explorer itunes keyboard laptop macro malware monitor motherboard network networking outlook outlook 2003 outlook 2007 outlook express pio problem problems router seo server slow sound sp3 spyware trojan usb video virtumonde virus vista vundo windows windows vista windows xp winxp wireless
DOS/PDA/Other
Search
Search in:
 
Advanced Search
Tech Support Guy Forums > Operating Systems > DOS/PDA/Other >
Batch file - Only move certain files


HELLO AND WELCOME! Before you can post your question, you'll have to register -- it's completely free! Click here to join today! We highly recommend that you print a copy of our Guide for New Members. Enjoy!

 
Thread Tools
equama's Avatar
Junior Member with 2 posts.
 
Join Date: Dec 2003
19-Dec-2003, 04:14 PM #1
Batch file - Only move certain files
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's Avatar
Senior Member with 152 posts.
 
Join Date: Jun 2003
Location: Lebanon, MO
20-Dec-2003, 07:03 AM #2
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....
__________________
-= Certifications =-
CCNA
Security+
A+ Certification
Microsoft Certified Professional
Microsoft Certified Systems Administrator
zephyr's Avatar
Distinguished Member with 2,386 posts.
 
Join Date: Nov 2003
Location: Southern California, USA
20-Dec-2003, 12:08 PM #3
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:
Attached Thumbnails
batch-file-only-move-certain-aaamypics4.gif  
mole's Avatar
Senior Member with 795 posts.
 
Join Date: Aug 1999
Location: Indian Head, MD "The land of large boxes."
29-Dec-2003, 07:52 AM #4
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} /?
__________________
mole
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are Off
Refbacks are Off

You Are Using:
Server ID
Advertisements do not imply our endorsement of that product or service.
All times are GMT -4. The time now is 06:28 PM.
Copyright © 1996 - 2008 TechGuy, Inc. All rights reserved.
Powered by vBulletin, Copyright © 2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0
Powered by Cermak Technologies, Inc.