ZIP files copy

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
cnu
Posts: 3
Joined: 24 Oct 2013 13:42

ZIP files copy

#1 Post by cnu » 24 Oct 2013 13:48

hi,

I am trying to copy ZIP files from one directory to other directory - it's giving problem for me.
can you please help. - it's giving error invalid paramater

@echo off
for /f "tokens=*" %%a in (' dir C:\Hotfix\ABC /b *.ZIP') do (
echo.Copying file '%%a'
xcopy '%%a' C:\Hotfix\Test
timeout 1
)

aGerman
Expert
Posts: 4743
Joined: 22 Jan 2010 18:01
Location: Germany

Re: ZIP files copy

#2 Post by aGerman » 24 Oct 2013 14:47

Untested:

Code: Select all

copy "C:\Hotfix\ABC\*.zip" "C:\Hotfix\Test\"

Regards
aGerman

cnu
Posts: 3
Joined: 24 Oct 2013 13:42

Re: ZIP files copy

#3 Post by cnu » 25 Oct 2013 08:12

i want to copy all files but one at a time. if i use below - it will copy all files same time.
copy "C:\Hotfix\ABC\*.zip" "C:\Hotfix\Test\"

My requirement - i want to copy ZIP files, file by file for every 1 or 2 seconds.

aGerman
Expert
Posts: 4743
Joined: 22 Jan 2010 18:01
Location: Germany

Re: ZIP files copy

#4 Post by aGerman » 25 Oct 2013 11:22

You want to slow down your script :? Strange requirement if you'd ask me.
Again untested:

Code: Select all

@echo off
for /f "delims=" %%a in ('dir /a-d /b "C:\Hotfix\ABC\*.ZIP"') do (
  echo Copying file "%%a"
  copy "C:\Hotfix\ABC\%%a" "C:\Hotfix\Test\"
  >nul timeout /t 1 /nobreak
)

Regards
aGerman

cnu
Posts: 3
Joined: 24 Oct 2013 13:42

Re: ZIP files copy

#5 Post by cnu » 30 Oct 2013 08:02

Yes i agree - this is strange requirement.
I miss Quotes ZIP file names contains space (that's reason my script failed)

Thanks for your help - your script works perfect.

Post Reply