How to delete fileshare folder using robocopy purge command - powershell

Iam currently using
Robocopy emptyfolder destination /purge
Or the command is robocopy destination emptyfolder /purge
Pls help
I have used the above mentioned command

Related

Robocopy Access Denied Error 5 From Powershell

I am copying files from my build server to a web server on Windows Server 2016. I am running the following from PowerShell. I am running this script with an administer account which has read/write access to the destination directory.
robocopy $Path\Items $_\Items /Sec /copy:DT /MIR /NDL /NS /NP /MT /w:1 /r:1 /R:20 2>&1 | out-host
I get the following error
ERROR 5 (0x00000005) Creating Destination Directory
\SOMEPATH\Data\Items\ Access is denied.
Ensure that you open your powershell session as an administrator (runas)
Also check the NTFS permission on the destination path and not only the security permissions.
If you are using a DFS path you should be better with the UNC path of the actual servername.
Hope this helps.
Actually I was not able to post this as a comment under your question, because I don't have 50 rep points yet.

Robocopy - ERROR 124 (0x0000007C) Creating Destination Directory

Hoping someone familiar with Windows 10 and Robocopy can help.
I am using the following robocopy command in backup script that is being run as Administrator (yes the real Administrator user ID)
runas /user:Administrator backup.bat
robocopy N:\FNL E:\FNL /MIR /E /Z /R:1 /W:1 /V /NP /LOG+:backup.log
As long as there have been no new files for directories created in the source folder, in this case N:\FNL it seems to run fine. As soon as I create a directory, for example "Fred", I get the following error:
ERROR 124 (0x0000007C) Creating Destination Directory N:\FNL\Fred
The system call level is not correct.
I have changed file permission for "Authenticated Users" to Full Control and as well have taken ownership of all folders and sub-folders/child objects on the target drive but still get the same error.
Anyone have an idea what I might be doing wrong?

PowerShell to Robocopy exclude is not working

In PowerShell I am trying to copy files from one location to another and want some files to be excluded. so I am using the following commands:
$Excludefiles="`"$((get-content 'C:\WorkingDirectory\List.txt') -join'""')`""
robocopy "C:\aa\" "C:bb\" /XF $Excludefiles
It seems it is excluding everything.
Please share your thoughts.

Robocopy non administrator

Can I run Robocopy with a non administrator user if I have read/write rights on both source and destination folders? Is there any side effect/limitation?
My command would be:
robocopy \\server1\SRC \\server2\DEST
THANKS!
Yes, this will work if you have the permissions. If you want to mirror subfolders then add the /MIR option.

please give the command in Robocopy i should use to copy the files from primary server to the secondary server

I got the command in robocopy as mentioned below
ROBOCOPY Source Destination [file…[file]…..] [Options]
Source: Source Directory
Destination: Destination Directory
Files: files to copy .
Please let us know what does the "\server\share\path" means? Kindly provide me an example on this command syntax and explain
An example of a ROBOCOPY call would be
ROBOCOPY C:\Users \\SERVER\backup\Users /MIR /R:0 /W:0
This copys everything under C:\Users to a network share at the UNC path \\SERVER\backup. If you don't know, what that means, google for 'UNC path' or find a nice tutorial that explains how to setup network shares under Windows.
Instead of \\SERVER\backup, that copies to a remote machine, you are totally free to use something like H:\ to copy to a local drive like a USB mass storage device.
The part /MIR /R:0 /W:0 are options of ROBOCOPY. Call ROBOCOPY /? to get an explanation for these.
Cheers,