Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

RoboCopy problem

Posted on 2008-06-16
10
Medium Priority
?
922 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 600 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
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
LVL 85

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 85

Assisted Solution

by:oBdA
oBdA earned 800 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 85

Assisted Solution

by:oBdA
oBdA earned 800 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

Prepare for your VMware VCP6-DCV exam.

Josh Coen and Jason Langer have prepared the latest edition of VCP study guide. Both authors have been working in the IT field for more than a decade, and both hold VMware certifications. This 163-page guide covers all 10 of the exam blueprint sections.

Question has a verified solution.

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

Restoring deleted objects in Active Directory has been a standard feature in Active Directory for many years, yet some admins may not know what is available.
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…
Simple Linear Regression

824 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