Solved

RoboCopy problem

Posted on 2008-06-16
10
879 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
 
LVL 83

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
Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

 
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 83

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 83

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

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

This article will show, step by step, how to integrate R code into a R Sweave document
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

706 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now