Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

RoboCopy problem

Posted on 2008-06-16
10
Medium Priority
?
912 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 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
The top UI technologies you need to be aware of

An important part of the job as a front-end developer is to stay up to date and in contact with new tools, trends and workflows. That’s why you cannot miss this upcoming webinar to explore the latest trends in UI technologies!

 
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

Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

Question has a verified solution.

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

Whether you’re a college noob or a soon-to-be pro, these tips are sure to help you in your journey to becoming a programming ninja and stand out from the crowd.
This article will inform Clients about common and important expectations from the freelancers (Experts) who are looking at your Gig.
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
Starting up a Project

688 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