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
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
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
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*
[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.
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.
I hope to experiment more with these suggestions tonight or tomorrow. I'll post my results thereafter. Thank you. Fred