Jump to content


Copy files with spaces


  • Please log in to reply
3 replies to this topic

#1 Guests

  • Guests

Posted 27 May 2012 - 07:17 AM

Hello. A simple question. How to copy all files which has spaces in their names from a folder to another folder? Thank you.

#2 Guests

  • Guests

Posted 27 May 2012 - 07:59 AM

You can store the name in a var:

file1=e:\image new.png
file2=c:\image set.png
filecopy,%file1%,%file2%


#3 Guests

  • Guests

Posted 27 May 2012 - 09:26 AM

But I don't know the name of the files. I need a command that reads the folder and then copies only those files which have spaces in their names.

#4 Guests

  • Guests

Posted 27 May 2012 - 10:45 AM

Sorry i misunderstood but was surprised that you could not simple copy with a literal string in filecopy when there was a space in it.

folder_source=e:\demo
folder_dest=c:\demo

Loop, %folder_source%\*.*
  {
  IfInString,A_LoopFileName,%A_Space%
      {
      file1=%A_LoopFilefullpath%
      file2=%folder_dest%\%A_LoopFileName%
      FileCopy, %file1%,%file2%
      list .=file1 "`n"
      }

}

MsgBox, %list%