Robocopy: Deleting Folder Files

Page 1 of 6 123 ... LastLast

  1. Posts : 331
    windows 10
       #1

    Robocopy: Deleting Folder Files


    I am new to Robcopy but starting to get the drift. I managed to move content across two drives today.

    I have not cut through how to remove folders in the source after downloading that content to another drive.

    The following seems to be the clearest, but I am not quite getting a method for removing a file like this one:
    C:\Users\mikei\Documents\Documents\00000.odd.bits.1
    ..............................
    Reference.....

    Fast Delete Complex Directories

    Another method for deleting folder files is RoboCopy.

    A destination folder is mirrored from an empty source directory, which forces RoboCopy to delete any files not in the source directory.

    The main command for RoboCopy to delete all files in the destination directory:

    robocopy "EmptyDir" "DestinationDir" /MIR /ETA

    /MIR – Mirror a directory


    /W:0 – Sets wait time between retries to zero secs


    /R:0 – Sets number of retries on failed copies to zero secs
    RoboCopy works with directories and sets of files within directories as opposed to individual files. In the example batch files using RoboCopy, RMDIR is still used to remove the temporary empty directory and the parent destination directory, and DEL is used for deleting files.

    ...........

    An example could help me sort this out?

    Thanks for any guidance.
      My Computer


  2. Posts : 4,165
    Windows 11 Pro, 22H2
       #2

    Take a look at this guide, especially the /Move switch:

    The Ultimate Guide to Robocopy
      My Computers


  3. Posts : 16,577
    Windows 10 Home x64 Version 22H2 Build 19045.3930
       #3

    I do not know what you are asking.
    1 You talk about using RoboCopy to copy somewhere else then delete the source i.e. you are asking about using RoboCopy to move folders & their files. See info about the /mov switch in RoboCopy - SS64
    then
    2 You start talking about using RoboCopy as a tool to remove rogue files that cannot be deleted by normal methods. See my ditty about using RoboCopy to clear out a rogue file - TenForums

    And please stop using the undefined term folder files. There are folders and there are files. I do not know what you intend to mean by folder files.


    All the best,
    Denis
    Last edited by Try3; 07 Apr 2023 at 12:50.
      My Computer


  4. Posts : 4,165
    Windows 11 Pro, 22H2
       #4

    @mikeincousa,

    Did you get what you needed figured out? From your post, it sounds like you needed to get a little bit of a better understanding of how the /MIR switch works for Robocopy.

    Put simply, this switch will exactly mirror the source to the destination. This means that after a mirror operation, the destination will contain exactly the same contents as the source. So, mirror can not only copy files from the source to the destination, but if there are any files on the destination that are not present on the source, then those files will be deleted from the destination.

    TIP: If you are ever uncertain what certain switches for Robocopy will do, and you are hesitant to run a specific commend, simply add a "/L" to the command line. The /L will cause Robocopy to list or show output as if it were performing the requested operations(s) but it won't actually copy, move, or delete any files. I use this all the time just to sanity check that I'm using all the right switches, especially if I'm performing a complex operation. When I'm satisfied that it is going to do what I want, then I rerun the command without the /L.

    I hope that helps!
      My Computers


  5. Posts : 2,886
    Windows 10 Pro for the Bro
       #5

    I use an app which does similar tasks that RoboCopy does. I use this app for a certain project.
    I don't like working with commands; instead, I like using an on-screen app that makes things simpler. Here's a picture of the app:

    Robocopy: Deleting Folder Files-image.png
      My Computer


  6. Posts : 331
    windows 10
    Thread Starter
       #6

    A couple of things have confused me.

    The article I referenced discussing "Another method for deleting folder files is RoboCopy....
    That is were a got the term "Folder Files".

    The author titles his piece "Fast Delete Complex Directories".
    My applications are for relatively modest home use: namely moving content from one drive to another.

    I cannot envision any situating where I would encounter "Fast Delete Complex Directories".
    Do I need to be concerned about such in home-computing? Maybe I am wrong on that point?

    The author also suggests, as you quote, using RoboCopy as a tool to remove rogue files that cannot be deleted by normal methods.

    I have never heard the term "Rogue Files". What are these? Would I typically ever encounter such in home-computing?

    I have not been able to define "Rouge Files" in the Internet. Can you provide a reference?

    For now I am thinking that doing a first run with MIR, then seeing how things come out. If all looks okay I could use MOV to
    to move my files from one drive to another freeing up space on the first drive.

    Your comments and suggestions on this idea please.

    Thanks to all for your comments and assistance.
      My Computer


  7. Posts : 16,577
    Windows 10 Home x64 Version 22H2 Build 19045.3930
       #7

    Mike,

    mikeincousa said:
    The article I referenced discussing "Another method for deleting folder files is RoboCopy....
    That is were a got the term "Folder Files".
    Understood.
    I don't think folder file is at all useful. It made me concerned that you had something particular in mind that I had failed to recognise. There are folders, there are files, all files reside in some folder or other.

    mikeincousa said:
    The author titles his piece "Fast Delete Complex Directories".
    My applications are for relatively modest home use: namely moving content from one drive to another.
    I cannot envision any situating where I would encounter "Fast Delete Complex Directories".
    I don't see any use for that either.

    mikeincousa said:
    The author also suggests, as you quote, using RoboCopy as a tool to remove rogue files that cannot be deleted by normal methods.
    I have never heard the term "Rogue Files". What are these? Would I typically ever encounter such in home-computing?
    I have not been able to define "Rouge Files" in the Internet. Can you provide a reference?
    There is no definition. I was just using the words rogue files as a piece of shorthand to mean files that cannot be deleted by normal methods.
    [I wasn't quoting anything or anybody.]
    Yes, people do sometimes come across files that cannot be deleted by normal means [hence the TenForums thread that I gave you a link to]. There have been several discussions in TenForums about this and there's an MS article that you probably don't want to read - You cannot delete a file or a folder [formerly KB320081] - MSLearn

    mikeincousa said:
    For now I am thinking that doing a first run with MIR, then seeing how things come out. If all looks okay I could use MOV to to move my files from one drive to another freeing up space on the first drive.
    Your comments and suggestions on this idea please.
    It's up to you.
    Personally, I always copy when I'm using RoboCopy. Then I could delete any unwanted source files afterwards.
    If I moved instead I'd worry about something going wrong partway through and losing files entirely.


    All the best,
    Denis
      My Computer


  8. Posts : 331
    windows 10
    Thread Starter
       #8

    Thanks for advice Denis.

    "Personally, I always copy when I'm using RoboCopy"
    I take this to mean you use the Windows Copy command?
    Not the Robocopy command "/copyall"?

    Which is better? Is there a significant difference?

    My concern with all of this is maintaining Timestamps while copying from one drive to another. I do not want to loose them after the operation.

    Can you offer any thoughts for the best way to copy Denis?

    Thanks again Denis
      My Computer


  9. Posts : 16,577
    Windows 10 Home x64 Version 22H2 Build 19045.3930
       #9

    "Personally, I always copy when I'm using RoboCopy" - I just meant using RoboCopy to copy rather than move.

    I regard RoboCopy as better than the Copy & XCopy commands because it can preserve the timestamps of folders [the Copy or XCopy commands would set some timestamps to the moment the copying was done].

    I use RoboCopy most often within batch files - I use it for backing up & I use it for one-way 'syncing' from my main computer to my other computers. Here is some generic syntax that I rarely deviate from.
    Code:
    Set BackupDrive=G:
    
    RoboCopy "C:\Users\%Username%\Documents\Business" "%BackupDrive%\Documents\Business" /S /R:10 /MT:32 /DCOPY:DAT /XA:SH /MIR
    We can discuss any syntax that my earlier SS64 link did not tell you about.
    - I generally run RoboCopy separately for each of my main folders within my user folder.
    - - I do not backup C:\Users\%Username%\Documents because some applications write their own boring rubbish within it that I have no interest in.
    - - My docs folder only has about 9 folders within it so I copy the above 8 times then change the folder names to suit.
    - - I then add similar lines for my audio folders for some backups.
    - I vary /MT:32 sometimes. Using multiple threads can speed up robocopying a lot. We can discuss this in a separate post if you like.
    - The DCopy thing is what preserves folder timestamps. No action is needed for file timestamps because it preserves them by default.


    I'm just about to log off but will deal with your questions when I'm back.
    Please don't hesitate to ask questions. RoboCopy is a powerful tool but it can be difficult to get to grips with.
    If you are going to write /DCOPY:DAT in a post then the way to get it to show correctly is to write it then select it then click on the Robocopy: Deleting Folder Files-noparse.png icon in the editing toolbar. Otherwise the forum software converts bits of it into a smiley face of some kind. You can also prevent this manually by writing in the code that that icon does for you
    [NOPARSE]/DCOPY:DAT[/NOPARSE]

    And do please explain what it is you are trying to do.
    - Your reference to deleting files afterwards might mean that I don't really get what you're up to.


    All the best,
    Denis
      My Computer


  10. Posts : 331
    windows 10
    Thread Starter
       #10

    Thanks as always Denis.

    My quandary is that my main drive is just about ready to seize up: it is very close to maximum capacity.

    A series of health and other events have kept me from keeping up with just about everything in my life for over 10 years. I had eye surgery in November: it is helping significantly,

    I have all my records in the main drive. Not sure of the size right now but it is likely .5 T drive. That drive holds records that go way back in my life, and my parents lives, their history, my history. gazillions of projects .......As I moved them into this computer I chucked the papers, photos, etc. If something goes fatally wrong with this drive it would be almost impossible to recover the data.

    I have attempted to learn Robocopy for around 10 years, in fits and starts, without grasping much until this past week, Over the course of my entire life I have had significant problems with reading and writing, but have managed to dig into very complex content. I have solid collection of diplomas and certificate and the like that illustrate my adaptions and determination.

    Robocopy has proved a very ornery cuss, but I feel I am close to developing nominal skills. Just getting this far bringing a sense of accomplishment.


    Not sure of what I am doing I have been reticent to try anything until the last few days. I have done some tests in two of the flash drives, with nominal success, using /MIR. I thinkI have that down. I stalled because I did have a solid grasp of how to safely remove the original content. Then I snagged again with the quandary that brought me to you.



    I have 2 1-T flash drives that are clean. And a wired drive with 1T capacity. And .5 T drive in a box. The last came about because of system failure a few years ago.

    What I need to do now Denis is get a solid grasp on establishing secondary mechanisms across backups, say 1 wired and 1 or two plugins (at least) for redundancy,

    BTW. I have Skype and Zoom and Google Talk accounts, with Skype being my main live communication mechanism.

    All for now.

    Again thanks for you kindness: it is very much appreciated.

    Michael
      My Computer


 

  Related Discussions
Our Sites
Site Links
About Us
Windows 10 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 10" and related materials are trademarks of Microsoft Corp.

© Designer Media Ltd
All times are GMT -5. The time now is 10:22.
Find Us




Windows 10 Forums