question

FredZuckerman-7337 avatar image
0 Votes"
FredZuckerman-7337 asked FredZuckerman-7337 answered

DOS Copy Command

I want to copy all files in a directory that end in "*1.zip" to the same name but ending in "*7.zip"

I tried (but it didn't work)

copy c:\users\fred\*1.zip c:\users\fred\*7.zip

Suggestions?
Thanks

windows-api
· 2
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Current versions of Windows do not support DOS. Use a command prompt window.

0 Votes 0 ·

I'm on W8.1 and I'm using these cmds in a batch file.

0 Votes 0 ·
WayneAKing-0228 avatar image
0 Votes"
WayneAKing-0228 answered WayneAKing-0228 published

Do all of the files to be copied have the same length
file names? If so, you can do this (example assumes
a five-character name preceding the 1):

copy ?????1.zip ?????7*

copy c:\users\fred\?????1.zip c:\users\fred\?????7*

  • Wayne

· 2
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Unfortunately, the filenames are various lengths. But I'll try your method and see if it works...tks

0 Votes 0 ·

Unfortunately, the filenames are various lengths

If all else fails, you could of course use a rather
"cludgy" approach such as this in a bat file:

copy c:\users\fred\?1.zip c:\users\fred\?7*
copy c:\users\fred\??1.zip c:\users\fred\??7*
copy c:\users\fred\???1.zip c:\users\fred\???7*
copy c:\users\fred\????1.zip c:\users\fred\????7*
copy c:\users\fred\?????1.zip c:\users\fred\?????7*
copy c:\users\fred\??????1.zip c:\users\fred\??????7*
etc.

  • Wayne

0 Votes 0 ·
WayneAKing-0228 avatar image
0 Votes"
WayneAKing-0228 answered WayneAKing-0228 published

[repost as my first try disappeared]

Unfortunately, the filenames are various lengths

If all else fails, you could of course use a rather
"cludgy" approach such as this in a bat file:

copy c:\users\fred\?1.zip c:\users\fred\?7*
copy c:\users\fred\??1.zip c:\users\fred\??7*
copy c:\users\fred\???1.zip c:\users\fred\???7*
copy c:\users\fred\????1.zip c:\users\fred\????7*
copy c:\users\fred\?????1.zip c:\users\fred\?????7*
copy c:\users\fred\??????1.zip c:\users\fred\??????7*
etc.

  • Wayne

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Viorel-1 avatar image
0 Votes"
Viorel-1 answered Viorel-1 edited

Try executing a .BAT file containing something like this:

 @echo off
 for %%f in (c:\users\fred\*1.zip) do ( call :sub "%%f" )
 goto :end
 :sub
 set p=%~1
 set p=%p:~0,-5%
 set p=%p%7.zip
 echo copy %1 "%p%"
 :end

It displays the generated "copy" commands. Remove "echo" to copy the files effectively.

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

FredZuckerman-7337 avatar image
0 Votes"
FredZuckerman-7337 answered

I hope to experiment more with these suggestions tonight or tomorrow. I'll post my results thereafter. Thank you. Fred

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.