I'm trying to copy my game saves from the appdata directory to another drive for backup purposes but the files wont copy - windows

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

Related

Bat file to remove all user folders with 20 in the name bat file

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 :)

SCCM 2012 to distribute files (not application)

I want to use SCCM 2012 to distribute some files (not application, no executable there).
I know there is a way to create a batch file with xcopy command, and create a package to deploy that batch file to the clients. However, if I use xcopy I cannot leverage the BITS functionality and other benefits from SCCM.
Is this possible?
Hi I can see this is an old post, but I have used SCCM to copy files in the past.
A company I worked for in the past refused to use GP for any file copy (don't get me started) so I had to implement GP files over SCCM.
Here are some examples I used.
xcopy User.bmp "%ProgramData%\Microsoft\User Account Pictures" /c /y /r
REG ADD HKLM\Software\FILE_GP /v Copy_User_image /t REG_sz /d 1.0 /f
timeout 5
if not exist "%windir%\system32\oobe\Info\backgrounds" md "%windir%\system32\oobe\Info\backgrounds"
xcopy backgrounddefault.jpg "%windir%\system32\oobe\Info\backgrounds" /c /y /r
REG ADD HKLM\Software\File_GP /v Backgrounddefault /t REG_sz /d 1.0 /f
timeout 5
I had the script add the Registry key so I could use Application deployment and have the detection method look for the key as well as the file. So if a user deleted the file it would return.
The main reason for me to have the Reg Key was if you wanted to push an updated version of the file I could set the new copy script to push 1.1 to the reg key and have the detection look for that version, then I could retire the 1.0 version.
I found also for short scripts of 1 file of small size without the timeout line it would report failed immediately, if there were larger files I didn't need the timeout. The initial fail does clear after some time without the timeout line.
It should work if you chose your settings right.
In your batch make sure that all the paths and references are relative and never absolute.
Then when you create the deployment there is a point called "Distribution Points" where you can select the deployment options for fast as well as unreliable networks. There you would have to choose "Download content from distribution point and run locally" in both cases. Then your batch would basically copy the files from the CCM cache to the hard drive.
This method should work for packages, for applications I think it would be more difficult because you cannot directly specify deployment options for fast networks there.
Packages are downloaded to the clients with BITS by default. The XCOPY command would copy from CCMCACHE to final destination on the machine.
Not sure if you have tried it or not but if you have deployed any .exe file for application its ask for dependence file in that you mention your required file which need to copy and create a script to copy data from ccmcache to copy the data to destination folder. for this you can get the use of BITS and to check if the file are copied or not you can use a proper detection method.
I used a PowerShell script for this purpose and it works like charm.
Create a new script and change this one liner to your mods:
Copy-Item -Path "\\[NETWORK PATH]" -Destination "[DESTINATION PATH]" -Recurse
Other way around—if need to make a required package—could be to create a new application deployment and run this through PowerShell (ExecutionPolicy ByPass) and manually install from the client side; if you don't want user interaction, make it a required deploy.

Having trouble writing batch script that mirrors folder to NAS drive

I've been looking throughout the forum to find an answer and nothing. I just want to copy files from my desktop folder to my NAS drive. I wrote this script below and I got an error "You do not have the Manage Auditing user right.***** You need this to copy auditing information (/COPY:U or /COPYALL)"
Any ideas why this wouldn't work or what the error means?
#ECHO OFF
SETLOCAL
SET _Source=C:\Users\desktop\folder
SET _dest=\\NASdrive\share\folder
SET _what=/COPYALL
SET _ options=/R:0 /W:0 /MIR /LOG:log.txt
ROBOCOPY %_source% %_dest% %_what% %_options%
You have a space between _ and options. Removing this space made the code work fine for me.
This link might have an explanation - Robocopy /copyall
Says:
This thing with robocopy /copyall is that the first thing it does it change the permissions on the destination folder that you are copying into.
I'm guessing your NAS doesn't appreciate robocopy changing permissions.
COPYALL is equivalent to /COPY:DATSOU
/COPY:copyflag[s] :: what to COPY for files (default is /COPY:DAT).
(copyflags : D=Data, A=Attributes, T=Timestamps).
(S=Security=NTFS ACLs, O=Owner info, U=aUditing info)
So you are telling Robocopy to set Attributes, ACLs, Owner, and Auditing Info on the destination drive. Since this is a NAS (and assuming not Windows) I don't think Robocopy can do this.

Cannot fully delete ProgramData from Windows 8 installation within WinPE

I have a script that runs in WinPE that takes a system drive with Windows installed and deletes everything off of the drive (keeping the filesystem intact).
When dealing with a Windows XP/Vista/7 installation it functions properly. attrib -S -A -H -I -R /S /D \ is run, and then everything is deleted.
However, within Windows 8, I run into an "Access Denied" error. For some reason, even as the SYSTEM user within WinPE, I can't edit the directory C:\ProgramData\Microsoft\Windows\LocationProvider. I can't use attrib to set attributes, I can't delete it - I can't even cd into it! dir /a just returns File Not Found.
Using rmdir /S /Q gives me the "Access Denied" error.
Assuming that the problem is related to permissions and/or ownership, you can work around it using the built-in robocopy tool - luckily, this is included in Windows PE.
First, create an empty directory, e.g., x:\empty and then run
robocopy /e /purge /b x:\empty c:\
The /b flag tells robocopy to use backup mode, which bypasses security.
Had the same problem. You need to take ownership first, for example using takeown.exe. Then fix permissions, for example using icacls.exe. Then proceed as you wish with copy, move, delete.

How to disable auto sleep on external USB hard drive in Windows XP

I've seen a related question on this website regarding a Linux system. I have the same question on a Windows XP OS. I bought a Winchester USB external HD, and found out from technical support that the sleep feature is in the firmware and cannot be turned off. I'm looking for an application that will automatically read/write to that drive periodically to keep that timer resetting (every 5 minutes?). Is anyone aware of a small application for Windows XP that will do that?
Thanks for your help.
I have tried nearly everything to fix this problem on my external which is shared out containing my movies. Nothing ever worked. I have a WD Mybook, and I think the sleep is occurring internally in the drive.
I have a solution that works for me, and should for anyone else. The key is to keep the USB drive doing something. Not a lot, but something simple, causes some type of change on the drive.
Windows XP does not have a SLEEP command, but you can download one and add it to the SYSTEM32 folder. Then all you need to do is make a simple batch file, and put it in your startup folder so it executes when you log in.
Make sure you have write access to the drive. Change the drive letter to yours...
Make a batch file.
:start
#echo off
#cls
#echo Keeping USB Drive Awake. Do not close this window!
#sleep 60
#dir E: /S /B >E:\keepawake.txt
#echo Drive Accessed %date% at %time% >keepawake.txt
goto start
This will write the full directory structure to a file on the E: drive in a file called keepawake.txt. Then it will overwrite it with a simple note containing the date and time. This will always be different. It will do it every 60 seconds.
Problem solved...
-Krehator
Make batch (.BAT) file something like this:
#echo off
:start
copy c:\windows\notepad.exe g:\ (Or whatever your external drive is)
choice /N /D Y /T 120 (The 120 is the delay in seconds)
goto :start
You could try NoSleepHD.
http://nosleephd.codeplex.com/
It writes an empty text file to your chosen drive every few minutes (you can choose the minutes) to stop the drive going to auto-sleep mode.
google: nosleephd
Ashx
I'm using the free/open source Windows program KeepAliveHD (http://keepalivehd.codeplex.com/) to accomplish this. Works well.
Any text editor with an autosave function would do it.
You could also write a batch file to get a directory listing, and have it act recursively (call itself) after a set time period. Or use windows scheduler to execute it.
use this batch file
change the 1st two lines letter t: to your drive letter.
it works in all versions of windows
#echo off
:start
REM --- Change the drive letter below to match your HDDs. To add another drive replicate the copy and del lines ---
copy NUL t:\HDDActive.txt
del t:\HDDActive.txt
TIMEOUT /T 30 /NOBREAK
goto start

Resources