<\/div>\n<\/aside>\n\n
Looking over the different switches try using /mov instead of /move<\/p>\n
/MOV : MOVe files (delete from source after copying). \n/MOVE : Move files and dirs (delete from source after copying).<\/p>","upvoteCount":2,"datePublished":"2013-04-12T16:59:11.000Z","url":"https://community.spiceworks.com/t/robocopy-move-switch/206416/8","author":{"@type":"Person","name":"michaelharrington2","url":"https://community.spiceworks.com/u/michaelharrington2"}},{"@type":"Answer","text":"
Jeremy and Krizz have the best answer to this. I guess I can’t accomplish this with just one line of command but will have to include a second line in my batch file to either recreate the folder or delete all files and folder after they have been copied. Thank you guys.<\/p>","upvoteCount":0,"datePublished":"2013-04-12T17:09:29.000Z","url":"https://community.spiceworks.com/t/robocopy-move-switch/206416/9","author":{"@type":"Person","name":"nick8246","url":"https://community.spiceworks.com/u/nick8246"}},{"@type":"Answer","text":"
robocopy.exe \"c:\\source\\transfer\" \"e:\\destin\\New\" *.* /S /Move\n<\/code><\/pre>\nthe .<\/em> should tell it just everything inside the folder.<\/p>","upvoteCount":0,"datePublished":"2013-04-12T17:23:24.000Z","url":"https://community.spiceworks.com/t/robocopy-move-switch/206416/10","author":{"@type":"Person","name":"benjaminpowers5593","url":"https://community.spiceworks.com/u/benjaminpowers5593"}},{"@type":"Answer","text":"Benjamin - that doesn’t work, it still deletes the source folder.<\/p>","upvoteCount":0,"datePublished":"2013-04-12T17:31:30.000Z","url":"https://community.spiceworks.com/t/robocopy-move-switch/206416/11","author":{"@type":"Person","name":"nick8246","url":"https://community.spiceworks.com/u/nick8246"}},{"@type":"Answer","text":"
Maybe use the “/Mov” switch instead of “/Move”<\/p>\n
/MOV :: MOVe files (delete from source after copying). \n/MOVE :: MOVE files AND dirs (delete from source after copying).<\/p>\n
***Edit - Sorry did not see michaelp236’s response.<\/p>","upvoteCount":2,"datePublished":"2013-04-12T18:22:17.000Z","url":"https://community.spiceworks.com/t/robocopy-move-switch/206416/12","author":{"@type":"Person","name":"chrissykora0224","url":"https://community.spiceworks.com/u/chrissykora0224"}},{"@type":"Answer","text":"
/Mov does not work either as it leaves a bunch of empty directories behind which I will then have to use another command line to delete everything inside the source folder.<\/p>","upvoteCount":0,"datePublished":"2013-04-12T18:45:47.000Z","url":"https://community.spiceworks.com/t/robocopy-move-switch/206416/13","author":{"@type":"Person","name":"nick8246","url":"https://community.spiceworks.com/u/nick8246"}},{"@type":"Answer","text":"
I use robocopy a lot as well and I would like to help but I cannot offer much beyond what as already been said. Maybe if I had a better understand of what your working with I could be more helpful. What is the folder structure like? Why do you need to keep the source folder? Things like that.<\/p>","upvoteCount":0,"datePublished":"2013-04-12T19:45:58.000Z","url":"https://community.spiceworks.com/t/robocopy-move-switch/206416/14","author":{"@type":"Person","name":"josh-cunning","url":"https://community.spiceworks.com/u/josh-cunning"}},{"@type":"Answer","text":"
If I wasn’t being clear from the previous response then here it is again. Both Jeremy and Krizz have answered my question.<\/p>","upvoteCount":0,"datePublished":"2013-04-12T19:50:31.000Z","url":"https://community.spiceworks.com/t/robocopy-move-switch/206416/15","author":{"@type":"Person","name":"nick8246","url":"https://community.spiceworks.com/u/nick8246"}},{"@type":"Answer","text":"
Please, mark BA/HP then. Until then, people will try to provide solutions to unsolved problem.<\/p>","upvoteCount":0,"datePublished":"2013-04-13T10:59:02.000Z","url":"https://community.spiceworks.com/t/robocopy-move-switch/206416/16","author":{"@type":"Person","name":"krzysztofradomski","url":"https://community.spiceworks.com/u/krzysztofradomski"}},{"@type":"Answer","text":"
Em8, you will need /e instead of /s to remove empty folders with RoboCopy (assuming this is still relevant).<\/p>","upvoteCount":0,"datePublished":"2014-10-31T08:54:55.000Z","url":"https://community.spiceworks.com/t/robocopy-move-switch/206416/17","author":{"@type":"Person","name":"jonathantite","url":"https://community.spiceworks.com/u/jonathantite"}},{"@type":"Answer","text":"
This will do it: robocopy c:\\source\\transfer e:\\destin\\new /mov /s<\/p>","upvoteCount":0,"datePublished":"2016-01-21T00:03:19.000Z","url":"https://community.spiceworks.com/t/robocopy-move-switch/206416/18","author":{"@type":"Person","name":"juanzepeda","url":"https://community.spiceworks.com/u/juanzepeda"}},{"@type":"Answer","text":"
Simply add the /EF (excluding the folder) to the cmd as below<\/p>\n
robocopy.exe “c:\\source\\transfer” “e:\\destin\\New” /S /Move /EF “c:\\source\\transfer”<\/p>\n
Hope this Helps<\/p>","upvoteCount":1,"datePublished":"2018-06-21T10:06:36.000Z","url":"https://community.spiceworks.com/t/robocopy-move-switch/206416/19","author":{"@type":"Person","name":"dhihan","url":"https://community.spiceworks.com/u/dhihan"}}]}}
Hi,
I’m trying to use robocopy to move files and folders from one location to another but it’s not working the way I want it to, can someone please help? I’m trying to use the /Move switch to move and delete all the files from the source after moving. The switch is working but it also delete the main source directory as well. This is what I have:
robocopy.exe “c:\source\transfer” “e:\destin\New” /S /Move
This works but then it also delete my “transfer” folder which I don’t want. I just want to everything inside the transfer folder and then delete everything inside the transfer folder only. What am I missing?
Thanks!
5 Spice ups
matt248
(Matt9169)
April 12, 2013, 4:31pm
2
possibly a “e:\source\transfer*” will fix this?
Run your command with copy in stead of move and then run a command to delete everything in that folder after it has run? I think that would be a good way to do it, don’t have the ability to check all the Robocopy commands at the moment.
keith1661
(___Keith___)
April 12, 2013, 4:37pm
4
jstear
(Jstear)
April 12, 2013, 4:39pm
5
mduprey
(MDuprey)
April 12, 2013, 4:50pm
6
Here’s Microsoft technet link on Robocopy and switches
See below about the move switch
/mov
Moves files, and deletes them from the source after they are copied.
/move
Moves files and directories, and deletes them from the source after they are copied.
3 Spice ups
robocopy.exe "c:\source\transfer" "e:\destin\New" /S /Move
mkdir "c:\source\transfer"
…perhaps?
2 Spice ups
Here’s a couple of links that use as reference when using robocopy
Looking over the different switches try using /mov instead of /move
/MOV : MOVe files (delete from source after copying).
/MOVE : Move files and dirs (delete from source after copying).
2 Spice ups
Jeremy and Krizz have the best answer to this. I guess I can’t accomplish this with just one line of command but will have to include a second line in my batch file to either recreate the folder or delete all files and folder after they have been copied. Thank you guys.
robocopy.exe "c:\source\transfer" "e:\destin\New" *.* /S /Move
the . should tell it just everything inside the folder.
nick8246
(Em8)
April 12, 2013, 5:31pm
11
Benjamin - that doesn’t work, it still deletes the source folder.
Maybe use the “/Mov” switch instead of “/Move”
/MOV :: MOVe files (delete from source after copying).
/MOVE :: MOVE files AND dirs (delete from source after copying).
***Edit - Sorry did not see michaelp236’s response.
2 Spice ups
nick8246
(Em8)
April 12, 2013, 6:45pm
13
/Mov does not work either as it leaves a bunch of empty directories behind which I will then have to use another command line to delete everything inside the source folder.
I use robocopy a lot as well and I would like to help but I cannot offer much beyond what as already been said. Maybe if I had a better understand of what your working with I could be more helpful. What is the folder structure like? Why do you need to keep the source folder? Things like that.
nick8246
(Em8)
April 12, 2013, 7:50pm
15
If I wasn’t being clear from the previous response then here it is again. Both Jeremy and Krizz have answered my question.
Please, mark BA/HP then. Until then, people will try to provide solutions to unsolved problem.
Em8, you will need /e instead of /s to remove empty folders with RoboCopy (assuming this is still relevant).
juanzepeda
(jrzepeda)
January 21, 2016, 12:03am
18
This will do it: robocopy c:\source\transfer e:\destin\new /mov /s
dhihan
(Naadhu)
June 21, 2018, 10:06am
19
Simply add the /EF (excluding the folder) to the cmd as below
robocopy.exe “c:\source\transfer” “e:\destin\New” /S /Move /EF “c:\source\transfer”
Hope this Helps
1 Spice up