Solved

RoboCopy problem

Posted on 2008-06-16
10
900 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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

Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

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.
While rebooting windows server 2003 server , it's showing "active directory rebuilding indices please wait" at startup. It took a little while for this process to complete and once we logged on not all the services were started so another reboot is …
An introduction to basic programming syntax in Java by creating a simple program. Viewers can follow the tutorial as they create their first class in Java. Definitions and explanations about each element are given to help prepare viewers for future …
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…

739 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