Solved

RoboCopy problem

Posted on 2008-06-16
10
894 Views
Last Modified: 2010-04-21
Hi All,

I would like to delete all files above a certain size (30 MB) in a collection of directorys under one root. (folder3)
I though the best way to do this would be using robocopy to move the selected files to a folder then just delete this folder.

Ive set up the following line - however it does not seem to work.

robocopy D:\folder1\folder2\folder3 D:\temp /MOV /MIN:30720000 /LOG+:"D:\temp\log.txt"


Any help please?

Thanks,
-Craig
0
Comment
Question by:chouckham
  • 5
  • 3
  • 2
10 Comments
 

Accepted Solution

by:
Ct-Whirlwind earned 150 total points
ID: 21795374
I have tested your code and it has worked pefectly for me.  Can you post the log file results and how are you starting the application?  Are the files you attempting to copy open?  Also this will only copy files from folder3 that are larger than 30MB if a file sits in a subdrectory of folder3 it is ignored.  If you wish to do subdirectories as well as a /S t the line ex:robocopy D:\folder1\folder2\folder3 D:\temp /S /MOV /MIN:30720000 /LOG+:"D:\temp\log.txt".

I think this is what you were looking for.
0
 
LVL 3

Author Comment

by:chouckham
ID: 21795715
Yes i want to do subdirectories also..
maybe thats the problem - i will test again tomorrow morning.

What do you mean about how am i starting the application?
Does double clicking not work? (hopefully im not missing something stupid here :-) )


Thanks!
0
 

Expert Comment

by:Ct-Whirlwind
ID: 21795788
I have had trouble with starting robocopy from other applications, but if you are using a scipt that is just fine.
0
Back Up Your Microsoft Windows Server®

Back up all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

 
LVL 84

Expert Comment

by:oBdA
ID: 21796958
Another switch you might want to add for this is /create; that way, you actually won't copy the content, robocopy will just create empty files. Should save quite some time ...
And when testing commands like that, use the /L switch, which will only list the files it would otherwise copy, but it won't actually do anything.
0
 
LVL 3

Author Comment

by:chouckham
ID: 21801164
Hi,

Tried it again - and it opens the command promt screen then closes very quickly. nothing in the log file.

Any ideas?
0
 
LVL 3

Author Comment

by:chouckham
ID: 21801381
Hi,

I tried runnign this direct from command prompt and get the error
"'robocopy' is not recognised as an internal or external comman, operable program or batch file."

I have admin tools installed. strange huh?
0
 
LVL 84

Assisted Solution

by:oBdA
oBdA earned 200 total points
ID: 21801612
robocopy is not part of the admin tools, it's part of the W2k3 Resource Kit available at http://www.microsoft.com/downloads/details.aspx?FamilyID=9D467A69-57FF-4AE7-96EE-B18C4790CFFD&displaylang=en
0
 
LVL 3

Author Comment

by:chouckham
ID: 21802217
oBdA,

thanks for that - its working great now. but only from the from resource kit tools cmd prompt.

Is there a way to set this up to to run when i just double click the batch file? (points increase)


Thanks!
0
 
LVL 84

Assisted Solution

by:oBdA
oBdA earned 200 total points
ID: 21802607
Close the command window you're currently working with, and re-open it.
Enter
path
in the command window, and the resulting output should contain the path to the ResKit tools, usually "C:\Program Files\Windows Resource Kits\Tools\".
In addition, you might want to replace "robocopy" in your script with "robocopy.exe" (to exclude the possibility of any script named robocopy.??? to be run instead of robocopy.exe), or with the full path to robocopy.exe:
"%ProgramFiles%\Windows Resource Kits\Tools\robocopy.exe" "D:\folder1\folder2\folder3" "D:\temp" /MOV /MIN:30720000 /LOG+:"D:\temp\log.txt" /create /L
0
 
LVL 3

Author Closing Comment

by:chouckham
ID: 31467675
Thanks Guy's!

Perfect!
0

Featured Post

NFR key for Veeam Backup for Microsoft Office 365

Veeam is happy to provide a free NFR license (for 1 year, up to 10 users). This license allows for the non‑production use of Veeam Backup for Microsoft Office 365 in your home lab without any feature limitations.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
How to get all the API from website? 11 106
AutoIncrement column based of FK 11 57
Generate Unique ID in VB.NET 21 69
Why is initMap returning "not a function" error. 3 33
Displaying an arrayList in a listView using the default adapter is rarely the best solution. To get full control of your display data, and to be able to refresh it after editing, requires the use of a custom adapter.
Computer science students often experience many of the same frustrations when going through their engineering courses. This article presents seven tips I found useful when completing a bachelors and masters degree in computing which I believe may he…
With the power of JIRA, there's an unlimited number of ways you can customize it, use it and benefit from it. With that in mind, there's bound to be things that I wasn't able to cover in this course. With this summary we'll look at some places to go…

821 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question