Moving and/or deleting files and folders in Windows 10 using a wildcard - last resort

Mostly, I’m just posting this in the hopes that right after I submit it, I will suddenly realize that I was just being stupid and wasted however long its going to take me to write out the problem I’m having. Also, because being pessimistic often leads to me being wrong (and I DO want to be wrong this time), I’m going to come right out and say that I highly doubt anyone will have a solution for me on this issue. So…onto my annoying problem with Windows 10:

I just updated from Windows 8.1 to 10 (long story, just took the plunge). I want to make a batch file that either 1) moves all the files and folders from a folder on my local drive to a shared network drive, or 2) copies all the files and folders from a local folder to a shared network drive then deletes everything in the local folder.

I can use xcopy to copy everything, but using:
del /S /Q *
followed by:
del /S /Q .
doesn’t work to delete folders…don’t even get an error message. Nor am I able to get the ‘rmdir’ command to work with a wildcard to delete folders.
The ‘move’ command also doesn’t want to work with a wildcard either. I can’t even move everything to another local folder, then delete that folder.

Yes, I’ve tried Google. Most of the results I get are for Windows 7, or doesn’t apply, or doesn’t work, or I have already tried. Maybe my search terms suck…I don’t know. I was just hoping to have one batch file I could run to do it all at once without having to open the file, select everything, and delete every day. Anyway, if anyone has a suggestion, I’ll give it a shot. This is really annoying me and if the last hour and a half is any indication, I’m not getting any sleep tonight.

-Gil102

Have you tried those commands in a shell running as admin? Depending on where you are copying, user accounts may not have priviledge to delete stuff.

Ha. I would just install cygwin or bash or something and use unix commands myself. Sorry I can’t be more helpful, but if you do know linux or unix that could be a last resort, anyway.

Thank you for the replies! I made sure I had Admin rights to the folder, and the commands still wouldn’t work in a shell. But as luck would have it, this morning I tried one last search and actually found something that would work. Unfortunately, I don’t understand WHY it works, but at least I’m not obsessed with it anymore.

In case anyone is wondering, this is the line in the batch file I had to add in order to delete folders:

for /d %%* in (c: emp*) do rmdir /s /q “%%~*”

Where ‘temp’ is the folder I needed to delete the files from. From the thread, I got this from, the poster originally said that if using a VBScript, only use one %, but a batch file requires two.

Anyway, thanks for reading my plea. I’m glad I posted!

I miss having deltree.

Sounds like you need robocopy.

I think you can use “RMDIR” to work as Deltree.

Also; Get Directory Opus for all your file/explorer needs. It is a AMiGA application that was ported to Windows, and it is awesome. Alternatively there is Total Commander.