Batch to move files in a folder to another folder?

試著忘記壹切 提交于 2019-12-11 07:56:56

问题


I want to create a batch file that moves all the files in this directory to its father directory. Like for example if I have a directory " Something " that contains files :

...New Folder/Something

And I want to move the files in " Something " to New folder.

Is there such a command?

Thanks a bunch :)


回答1:


Presuming you're talking about Windows batch files, move *.* ..\ should do the trick.

Edit: For example, if you opened cmd, you could input:

cd C:\New Folder\Something
move *.* ..\

which would move all files in C:\New Folder\Something into its 'father' directory.




回答2:


It is possible only if you don't have subdirectories, because move doesn't walk the subdirectories. You can use xcopy with /E, however it will not delete the copied files and directories. Then you should use del ., but to delete the subdirectories you should call rd for each one, and that is not possible in batch files.



来源:https://stackoverflow.com/questions/2754806/batch-to-move-files-in-a-folder-to-another-folder

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!