I'm trying to automatically move the subfolders and files from my Dropbox folder on my F: Drive to a separate folder on the same drive, therefore emptying my Dropbox and freeing up space in it while backing up the files.
I tried this in Batch:
MOVE /-Y "F:\Dropbox\files\camera" "F:\backup\Camera\"
pause
but I keep getting Access Denied even when running as Administrator.
I also tried this in VBS:
With CreateObject("Scripting.FileSystemObject")
.MoveFile "F:\Dropbox\files\camera*", "F:\backup\Camera\"
End With
but I only got Path Not Found from that.
So pretty much I'm a bit stumped, or overlooking something obvious, But basically I just want to make a small script in vbs or batch that allows me to move all the sub-folders and files from F:\Dropbox\files\camera\ to F:\backup\camera\ so I can set it as a scheduled task and let it run each day so that it empties my Dropbox folder(and therefore my Dropbox account) of all files and folders and backs them up.
Any help would be appreciated, I have already searched a number of different options and none seems to work specifically for my purpose.
I suggest using ROBOCOPY
instead of MOVE
.
I have a similar backup script that uses it.
See:
https://learn.microsoft.com/en-us/windows-server/administration/windows-commands/robocopy
@ECHO OFF
ROBOCOPY /E /MOVE "F:\Dropbox\files\camera" "F:\backup\Camera\"
MKDIR "F:\Dropbox\files\camera"
Options:
/E : Copy Subfolders, including Empty Subfolders.
/MOVE : Move files and dirs (delete from source after copying).
Because of the /MOVE
switch, I need to re-create the source directory because ROBOCOPY
moves it to the destination directory. ROBOCOPY
, by default, will retry the operation if it fails. See the /R:n
and /W:n
options to customize it. Also, the command will print a lot of info messages to the terminal, but you can customize it using the ROBOCOPY
's logging options (ex. /NJH
, /NJS
, etc).
For the "Access Denied" error, make sure that:
MKDIR "F:\backup\Camera\some_file.txt"
)MKDIR "F:\backup\Camera\some_folder"
)