Move 10 files at a time

Microsoft Windows server 2003 enterprise
July 26, 2010 at 15:26:14
Specs: Windows Server 2003
Hello,

I have a requirement where i should move 10 files at once from one folder to another.Let us assume Folder 1 has 122 files, I need to move 10 files in one move, another 10 in other move and loop through this process for 13 times to move all the files from Folder1 to Folder2.I am new to DOS scripting. I would really appreciate if any one can help me.


See More: Move 10 files at a time

Report •

#1
July 26, 2010 at 19:11:01
download coreutils and gawk for windows(see my sig), then do this

NR%10==1{
  cmd="cp \042"
  for(i=1;i<=d;i++){
     cmd=cmd a[i]"\042 \042"
  }
  cmd = cmd "c:\\tmp\042"
  print cmd
  # system(cmd) #uncomment to use
  d=0
  delete a
  print "-------------"
}
{
 a[++d] = $0
}END{
 for(i=1;i<=d;i++){
     cmd=cmd a[i]"\042 \042"
 }
 print cmd
 #system(cmd) #uncomment to use
}

save the above as mymove.awk. Then do this on command line

c:\test> dir /b /o-d >tmp
c:\test> gawk.exe -f mymove.awk tmp


remove the "#" to do actual copying.

GNU win32 packages | Gawk


Report •
Related Solutions


Ask Question