Faroff Posted September 11, 2014 Posted September 11, 2014 Hello All, Ok so I am on windows 7 and I am trying to delete a file from a folder copy the remaining contents of that folder to its parent folder then remove the two folders in that parent folder. Here is the script I am using. @echo OFF del C:\Users\Public\Desktop\Parent folder\Baby-A\The file I want deleted.docx copy C:\Users\Public\Desktop\Parent folder\Baby-A *.* C:\Users\Public\Desktop\Parent folder rmdir C:\Users\Public\Desktop\Parent folder\Baby-A rmdir C:\Users\Public\Desktop\Parent folder\Baby-B pause FYI- The files I want saved are shortcuts (not sure if that matters but I think it might) and the pause is only there for debugging purposes. Every time I try to run the script it says that the system cannot find the path specified even though I have verified their locations several times I can also browse to the specific folders using the CMD, but when I try to enter in "copy C:\Users\Public\Desktop\Parent folder\Baby-A *.* C:\Users\Public\Desktop\Parent folder" from C:\users\public\desktop\parent folder\Baby-A it says file not found. Please help!! Thank you for taking the time to read my question.
Arthur Posted September 11, 2014 Posted September 11, 2014 You need to add quotes around the paths that contain spaces. @echo off del "C:\Users\Public\Desktop\Parent folder\Baby-A\The file I want deleted.docx" copy "C:\Users\Public\Desktop\Parent folder\Baby-A\*.*" "C:\Users\Public\Desktop\Parent folder" rmdir "C:\Users\Public\Desktop\Parent folder\Baby-A" rmdir "C:\Users\Public\Desktop\Parent folder\Baby-B" pause 1
Faroff Posted September 11, 2014 Author Posted September 11, 2014 Oh, that was quite simple! Thank you very much!
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now