i cannot copy file with folder that has space in there.

i want to copy all of the file in the sub directories under C:\ERP_Interface\PRCERP\New Folder,

but if i have a space in the path i cannot copy the files.how can i handle the path with pace and the sub directories with space too?

FOR /R "C:\ERP_Interface\PRCERP\New Folder" %%G IN (*PUD*.csv) DO move %%G C:\ERP_Interface\PRCERP\PUD

::Robocopy "C:\ERP_Interface\PRCERP\New Folder\" C:\ERP_Interface\PRCERP\PUD *PUD*.csv /SEC
有帮助吗?

解决方案

Not sure if you are moving or copying the files (commands in your code are contradictory). But the basic idea is the same: quote the paths.

In move %%G ..., %%G will contain a path with spaces so it should be

move "%%G" ...

In the case of robocopy, the syntax will be something like

Robocopy "C:\ERP_Interface\PRCERP\New Folder" C:\ERP_Interface\PRCERP\PUD *PUD*.csv /S /SEC

That is, you have indicated that want to copy data, attributes, timestamps, acls, but you forgot the indicate that you want to copy subdirectories

If instead of copying the files you want to move them, add /MOVE (move files and folders) or /MOV (move only files)

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top