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
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
Current versions of Windows do not support DOS. Use a command prompt window.
I'm on W8.1 and I'm using these cmds in a batch file.
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
Unfortunately, the filenames are various lengths. But I'll try your method and see if it works...tks
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
[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
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
4 people are following this question.