开发者

Batch to move files in a folder to another folder?

开发者 https://www.devze.com 2022-12-28 17:24 出处:网络
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 :

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/So开发者_如何学Pythonmething

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

Is there such a command?

Thanks a bunch :)


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.


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号