Computing.Net > Forums > Disk Operating System > batch to copy even numbered files

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

batch to copy even numbered files

Reply to Message Icon

Name: Diddles
Date: September 6, 2004 at 12:35:37 Pacific
OS: XP
CPU/Ram: Athlon/256
Comment:

I'm really hoping sombody can help me with this - I'm a lingo programmer and don't know a lot about DOS, so if you know the answer to this one, you'll have to baby me along. I have a folder with a lot of jpeg images (e.g. j001, j002 etc.) and need to copy every file with an odd numbered name to another folder/or copy the first and every alternate file following it.

I'm really desperate, so any help would be greatly appreciated.

Dee




Sponsored Link
Ads by Google

Response Number 1
Name: wizard-fred
Date: September 6, 2004 at 23:18:58 Pacific
Reply:

I would write a small program to analyze the last character of the filename (excluding extension) and create either a batch file or use a system function to move the file.

Copying the first and every alternate file assumes the directory is sorted or accessed in a sorted manner.

As a matter of interest, how many files?


0

Response Number 2
Name: Diddles
Date: September 7, 2004 at 01:27:12 Pacific
Reply:

There's about 6 thousand - all named sequentially.

thanks for getting back to me


0

Response Number 3
Name: IVO
Date: September 7, 2004 at 03:00:49 Pacific
Reply:

If files are named sequentially the following script should work for you, but be aware it is far then perfect and I submit that only to stop your pain.

By the way better you post in the Programming Forum next time.

Named the batch JCopy.bat, type JCopy From_Folder To_Folder (Folder's namrs must not have embedded blanks)

@Echo Off

Set Flag=1
For %%A in (%~f1\*.*) Do Call :COPY %%A %~f2
Set Flag=
GoTo :EOF

:COPY
If %Flag%==1 (
Copy "%1" "%2" & Set Flag=0
) else (
Set Flag=1)
GoTo :EOF


0

Response Number 4
Name: Diddles
Date: September 7, 2004 at 15:22:01 Pacific
Reply:

Thanks - it worked great!


0

Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More


Mini Win98 add-ons for DO... rename files with % in th...



Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Disk Operating System Forum Home


Sponsored links

Ads by Google


Results for: batch to copy even numbered files

Batch to copy 2 day old files www.computing.net/answers/dos/batch-to-copy-2-day-old-files/829.html

script to copy the newest file www.computing.net/answers/dos/script-to-copy-the-newest-file/13858.html

bat file to copy temp internet files www.computing.net/answers/dos/bat-file-to-copy-temp-internet-files/3877.html