I'm trying to automate a little backup process of a folder from the computer to a network-drive. I found the code below to delete the folder on the network drive but I can't get it working because it says "Unable to find the specified file" for each files that it tries to remove. Why?
rd /s /q "\\MY SERVER\mysharename\myfolder"
Maybe there is a problem with concepts. It is not "\\server\folder", but "\\server\shareName". And you can not remove the share with a rd command.
Related
I'm trying to copy my save files for my games from my AppData directory to another drive on my system but the files fail to copy. I'm using robocopy to try to achieve this and am not sure what is going wrong.
The Script I'm using is:
#echo off
set "source=C:\Users\MyUser\AppData"
set "destination=F:\Game_Saves"
robocopy "%source%" "%destination%" /E /Z /J /EFSRAW /W:1 /R:0 /REG /XJ
exit /b
I've had times where I went to play a game after some drive failure or general errors from my ISCSI drives changing letters and losing my save for my games through Epic Games because of the crappy download system they use and i just want to backup my saves to the other drive and then using duplicati to do a more long term backup and cant seem to find out why the files wont copy. If anyone can help me troubleshoot this I'd be very greatful.
I tried changing flags in my script and setting flags I thought might be helpful to my usage but it hasn't worked. I just dont want to lose my saves as some of them have 100s of hours in them. I should also mention that I want my script to complete as fast as possible which is why I don't have any retries set as the only errors I was running into were "Permission Denied" errors for folders I don't need to backup.
Drive F:\ is just a slow SATA hard drive in my PC and not an ISCSI drive and "copy.bat" my batch script is in the root of F:\
Task Scheduler Settings:
General:
Run whether user is logged in or not - yes
Run with highest privileges - yes
Triggers:
Run weekly - yes
Stop task if it runs for longer than - 4 hours
Enabled - yes
Actions:
Start a Program - yes
Program/Script - F:\copy.bat
Removing the /EFSRAW flag worked to copy the files though I'm still unsure as to why it was causing interference in the first place unless it just doesn't allow the copy of un-encrypted files in the first place with that flag set.
Updated script for others if they want to use it though it is clunky as it copies all of AppData and that is around 80 GB for my computer so this is not recommended.
#echo off
set "source=C:\Users\MyUser\AppData"
set "destination=F:\Game_Saves"
robocopy "%source%" "%destination%" /E /Z /J /W:1 /R:0 /REG /XJ /LOG+:copylog.txt
exit /b
For Example :
suppose I have a directory like "C:\Users\user\Downloads\Compressed\Developing Android Apps Videos"
Now while deleting "Developing Android Apps Videos" folder, If an error popped up with this message that "FOLDER DOESN'T EXIST", How to fix such issue ???
you have to follow this steps to solve this issue:
open cmd administration
enter command -> cd /d C:\Users\MK\Downloads\Compressed\Developing Android Apps Videos
enter command -> dir /x
After the 3rd step, you can see some folder name and you need to use that name for 5th step.
enter command -> rmdir /q /s enter-folder-name
Hopefully, this could help you and please find an attachment for the exact process.
Thank you
You can try below command also.
1.Open command prompt
2.Run below command
RD /S /Q pathOfTheFolder
ex: RD /S /Q C:\Users\Me\Documents\NewFolder
Here
/S- Delete all sub folders and files. So once you delete any folder, all files and folders with in that folder will be deleted
/Q - Doesn't show Yes/No confirmation dialog box before deleting files are folders.
I just started working in a school and the way we have the computers set up they automatically download a students user from the network when a student logs into any computer. We're working on making a script to run this command for cleaning them :
for /D %f in (*20**) do rmdir %f /s /q
In command prompt it shows every user with 20 in the name and deletes them from the computer along with everything in these folders.
We can't just change the file name to .bat instead of storing it in a note pad to copy to a command prompt window.
The batch file we currently have is
#echo off
pause
for /d %%f in (*20**) do rmdir C:\Users\%%f /s /q
pause
Which shows each pause to try to help me debug it but doesn't delete the folder. What am I doing wrong here?
I wouldn't do this. As I assume it's something like:
Regular%20User
%20 is basically a space.
To address your issue of wanting to clean them, as I assume it is the temp profile that is created when they login(from a network profile), rather than making the script clean anything with 20 in it, make a script that removes users locally that are of a certain Group Policy group. That way your admin accounts stay locally, and if your script is done right, your student's profiles are autocleaned after a set delay. (I would recommend 30 days, as you can use the temp profile as evidence if a student is caught on a computer he/she shouldn't be on :)
I'm trying to delete a folder in my output directory using the following command line:
del /F "$(TargetDir)Content\"
Tho I always end up exiting with error code 1. I've tried several different ways, without /F, with/without slash both before and after, etc.
Error 1 The command "del /F "E:\proj\bin\Windows\Debug\Content\"" exited with code 1.
There are a lot of questions regarding deleting files in post-build event command lines in visual studio, which works fine, but I can't seem to delete a folder without getting code 1.
Any help is appreciated!
RD /S /Q "Full Path of Folder"
In your case:
RD /S /Q "$(TargetDir)Content\"
Browse to the same folder using Command Prompt, and then run that command and see what the actual error is. Might be permissions or something is in use.
I have a folder without any file in it in my external hard. I am able to rename it, but not able to delete it. I ran CMD utility as an administrator and I tried the commands "del foldername", "rd foldername", "deltree foldername" (the last one was not allowed in Windows XP). They give me the message "Access is denied." for "rd foldername". How can I delete it?
I am not cmd guru, but simple as 1-2-3 is delete folder using system account.
at 11:11pm /interactive cmd
Now if system command appear, delete folder:
del foldername
try
attrib /s foldername
This should show you the directory attributes.
If the response is
R x:\dirname
then the directory is "read-only". In that case, execute
attrib -r foldername
and you should then be able to rd it.
It may be that the directory has (possibly hidden, possibly read-only) contents. The attrib /s should show these to you.