Moving the 'My Documents' folder (and others) to a different hard disk

Page 8 of 10 FirstFirst ... 678910 LastLast

  1. Posts : 15,982
    Win 10 Pro 64-bit v1909 - Build 18363 Custom ISO Install
       #71

    Thanks @Matthew Wai and @OldNavyGuy.

    I did find this on SS64 . . .
    Code:
    Redirecting output using /LOG is recommended for even better performance.
    
    Logging options
    
                    /L : List only - donít copy, timestamp or delete any files.
                   /NP : No Progress - donít display % copied.
              /unicode : Display the status output as Unicode text.
             /LOG:file : Output status to LOG file (overwrite existing log).
          /UNILOG:file : Output status to Unicode Log file (overwrite)
            /LOG+:file : Output status to LOG file (append to existing log).
         /UNILOG+:file : Output status to Unicode Log file (append)
                   /TS : Include Source file Time Stamps in the output.
                   /FP : Include Full Pathname of files in the output.
                   /NS : No Size - donít log file sizes.
                   /NC : No Class - donít log file classes.
                  /NFL : No File List - donít log file names.
                  /NDL : No Directory List - donít log directory names.
                  /TEE : Output to console window, as well as the log file.
                  /NJH : No Job Header.
                  /NJS : No Job Summary.
    
    /V : Produce Verbose output log, showing skipped files.
    
    If creating a progress logfile with /LOG , specify a destination directory that already exists, robocopy will create the file but will not create a log directory automatically.
    I will look through the link that @OldNavyGuy posted later today or tomorrow.
      My Computer


  2. Posts : 1,867
    Windows 10 Pro 2004 20H1
       #72

    PowerShell may be an option as well.

    Copy-Item: Copying Files like a Boss in PowerShell
      My Computer


  3. Posts : 11,327
    Windows 10 Home x64 Version 21H2 Build 19044.1706
       #73

    Matthew Wai said:
    Is it possible for Robocopy to give an advance warning if a certain number of files are to be deleted/overwritten?
    Matthew,

    You can write a script using RoboCopy /L switch to achieve that. The challenge in writing a tool as a common utility [probably as a 'sub-routine' batch file that gets called by other batch files] would be, I think, deciding the least error-liable method of extracting the results. I think the best method would be extracting results from the end table using a For command.

    1 Example of no files being selected

    I ran the command and it showed that no files would be copied {I knew this was the case because I had just updated the MIRror folder on G:\ before I saw your post}.
    - The 'Copied' column normally means what it says but, when the /L switch is used, it means would be copied.
    Code:
    RoboCopy D:\Desktop G:\Desktop /S /R:10 /MT:1 /DCOPY:DAT /XA:SH /MIR /L
     -------------------------------------------------------------------------------
        ROBOCOPY     ::     Robust File Copy for Windows
     -------------------------------------------------------------------------------
       Started : 12 July 2020 10:16:57
        Source : D:\Desktop\
          Dest = G:\Desktop\
         Files : *.*
       Options : *.* /L /S /E /DCOPY:DAT /COPY:DAT /PURGE /MIR /XA:SH /MT:1 /R:10 /W:30
     ------------------------------------------------------------------------------
    
     ------------------------------------------------------------------------------
                    Total    Copied   Skipped  Mismatch    FAILED    Extras
         Dirs :       156       156       156         0         0         0
        Files :      1639         0      1639         0         0         0
        Bytes :   2.714 g         0   2.714 g         0         0         0
        Times :   0:00:00   0:00:00                       0:00:00   0:00:00
        Ended : 12 July 2020 10:16:57

    2 So I then added 2 extra files that would be copied [and would overwrite any corresponding file in the destination] were it not for the /L switch
    Code:
    RoboCopy D:\Desktop G:\Desktop /S /R:10 /MT:1 /DCOPY:DAT /XA:SH /MIR /L
    -------------------------------------------------------------------------------
       ROBOCOPY     ::     Robust File Copy for Windows
    -------------------------------------------------------------------------------
      Started : 12 July 2020 10:22:28
       Source : D:\Desktop\
         Dest = G:\Desktop\
        Files : *.*
      Options : *.* /L /S /E /DCOPY:DAT /COPY:DAT /PURGE /MIR /XA:SH /MT:1 /R:10 /W:30
    ------------------------------------------------------------------------------
    100%        New File              619585        D:\Desktop\Robocopy - SS64.pdf
    100%        New File                 175        D:\Desktop\Robocopy - SS64.url
    ------------------------------------------------------------------------------
                   Total    Copied   Skipped  Mismatch    FAILED    Extras
        Dirs :       156       156       156         0         0         0
       Files :      1641         2      1639         0         0         0
       Bytes :   2.715 g   605.2 k   2.714 g         0         0         0
       Times :   0:00:00   0:00:00                       0:00:00   0:00:00
       Ended : 12 July 2020 10:22:28
    As you can see, RoboCopy's end table correctly states that 2 files would be copied and it lists them.

    3 Working on the number of folders that would be copied is less straightforward. I added a folder to my Desktop and these were the results
    Code:
    RoboCopy D:\Desktop G:\Desktop /S /R:10 /MT:1 /DCOPY:DAT /XA:SH /MIR /L
    -------------------------------------------------------------------------------
       ROBOCOPY     ::     Robust File Copy for Windows
    -------------------------------------------------------------------------------
      Started : 12 July 2020 10:41:15
       Source : D:\Desktop\
         Dest = G:\Desktop\
        Files : *.*
      Options : *.* /L /S /E /DCOPY:DAT /COPY:DAT /PURGE /MIR /XA:SH /MT:1 /R:10 /W:30
    ------------------------------------------------------------------------------
    100%        New File              619585        D:\Desktop\Robocopy - SS64.pdf
    100%        New File                 175        D:\Desktop\Robocopy - SS64.url
    ------------------------------------------------------------------------------
                   Total    Copied   Skipped  Mismatch    FAILED    Extras
        Dirs :       157       157       156         0         0         0
       Files :      1641         2      1639         0         0         0
       Bytes :   2.715 g   605.2 k   2.714 g         0         0         0
       Times :   0:00:00   0:00:00                       0:00:00   0:00:00
       Ended : 12 July 2020 10:41:15
    You can see that the number of folders has increased by one since the previous test but you can only identify that 1 would be copied by comparing the Copied & Skipped columns. RoboCopy's report table adopts a different attitude to folders than it does to file.

    4 I did not do any further testing but I think the Extras column would identify the deletion count when the /MIR switch is used [or /Purge]. 'Extras' is how RoboCopy refers to folders/files in the destination that are not in the source.

    Denis
    Last edited by Try3; 12 Jul 2020 at 05:08.
      My Computer


  4. Posts : 889
    W10-2009 19042.1348
       #74

    Paul Black said:
    I will however, investigate why there is a problem with it on my laptop. It does work on the laptop as long as I DON'T use the parameters /MT:1 /DCOPY
    I was intrigued, and had a look to see if others have had an issue with the /MT switch. In the process, I found cases where people had more than one version of Robocopy on their machines (in different locations), and found that if they were (unknowingly) launching an early (say XP) version, the /MT switch was not available. So I thought I'd check my version, in the supposedly 'correct' path under Windows\System32, and at first Robocopy was nowhere to be seen - I played with the column sort in Explorer, but nothing, so I got Agent Ransack to do some hunting, and it found two copies (plus \winssxs copies/links as well), one in system32 and one in SysWOW64. On opening the links from AR, there it was in system 32 - and now visible every time - huh?

    According to 'properties>Details, they were both the same version (10.0.18362.1), but were different sizes - even more weird. So I compared the files with FileAlyzer_2, which declared them identical (CRC, MD5 size etc), but Explorer properties said different (all sizes in bytes):
    =============== Explorer properties
    =========FileAlyzer size size_on_disk
    system32 103,936 134,657 77,824
    sysWOW64 103,936 103,936 106,496


    (I blowed if I can find a way to align columns - 'code' is no use, I want a fixed-space font...OK, 'c' tags nearly work, whatever they are!)

    So I then checked to see if they were being compressed (according to explorer>properties>advanced), and apparently not. I did run each from a command prompt, and both offered the MT switch. So I now have my own mystery to solve (I may decide its all too much and give up), but it may help you. If your laptop has multiple copies (which are different), you will need to check your 'path' variable to see which will run from a prompt in another folder.

    BTW: Why are you keen to suppress threaded copying? Why not leave the MT switch out, or accept its default of 8?

    Good luck, Martin
    Last edited by mngerhold; 12 Jul 2020 at 06:30.
      My Computer


  5. Posts : 11,327
    Windows 10 Home x64 Version 21H2 Build 19044.1706
       #75

    Martin,

    mngerhold said:
    BTW: Why are you keen to suppress threaded copying? Why not leave the MT switch out, or accept its default of 8?
    I think it's actually my fault. I suggested the code he's started with and I then added some discussions about playing around to get the best /MT setting in the circumstances.
    my ditty - Using RoboCopy threading [post #10] - TenForums

    But the lack of DCOPY is also a shame. Keeping folder LastModified & Created dates-times is one of the benefits of using RoboCopy rather than some other tool.

    Denis
      My Computer


  6. Posts : 15,982
    Win 10 Pro 64-bit v1909 - Build 18363 Custom ISO Install
       #76

    To add to the above post #73 by Denis,

    I have been doing some testing. I ran the code . . .
    Code:
    RoboCopy "C:\Source Folder" "F:\Target Folder" /S /R:10 /MT:1 /DCOPY:DAT /XA:SH /MIR > "%userprofile%\desktop\TestResults.Log"

    I had an OpenOffice Writer sheet open in one of the source directories which added an extra entry in the source folder files list of .~lock.RoboCopy_Information, which obviously disappears once OpenOffice Writer is closed.

    After I ran the code, I noticed in the log file results that the .~lock.RoboCopy_Information directory entry from the source appeared in the total number of files copied for the directory, but it didn't obviously appear in the destination folder.

    It probably goes without saying, but there should be NO files in ANY of the source directories open when running the code so as to make the data in the log file 100% accurate.

    Just an observation really.
    Last edited by Paul Black; 12 Jul 2020 at 06:59.
      My Computer


  7. Posts : 11,327
    Windows 10 Home x64 Version 21H2 Build 19044.1706
       #77

    Paul Black said:
    It probably goes without saying, but there should be NO files in ANY of the source directories open when running the code so as to make the data in the log file 100% accurate.
    Paul,

    There are many applications that are happy for their files to be copied while they are being edited. Excel for example. Only the saved version is copied [edits that have not yet been saved get ignored].

    Some applications, such as yours, use temporary files and they can be avoided using the various RoboCopy /X switches.
    - Access, just for example, creates a temporary .laccdb file when a database is open. I use the /XF *.laccdb switch to avoid trying to copy them.
    - Temporary files can be a problem for backups that run while you are working. If I did not use the /XF *.laccdb switch, I might close the database after RoboCopy has decided that there was a .laccdb file to copy but before RoboCopy had actually done the copying - so RoboCopy would generate an error.
    - Some others create hidden temporary files and they are skipped using the /XA:SH switch that you have already included.

    Some applications might get really stroppy about attempts to copy their files while they are open.
    - MS Office Outlook is the only example I know of this.
    - I was warned by some competent people that even attempting to copy an Outlook .pst file while Outlook was running might irretrievably corrupt that .pst file.
    - Outlook can give even more serious problems if you attempt to copy to a network location while it's running.
    - - Whilst a local location copy might just get refused, network locations have been known to delete the previous copy there before refusing yet without even showing you anything in the log to warn you.
    - - The first thing you know about it is when you go to the network to retrieve your backup and find that there is nothing there [not even your previous backed up copy].

    You can include tests in your batch file to see if particular applications are open.
    - First, you need to run your application and then, while it's open, run the command tasklist to find the precise name it uses for that running application.
    - Then you can use something like these within your code [the echoes are just there to help me when experimenting]

    Code:
    ::::: If I am going to bail out if a given application is running then this is the most straightforward construction
    :: Set the image name of the application to search for
    set TestAppl=outlook.exe
    tasklist | find /i "%TestAppl%" >nul && ((Echo the tested application is running so I am bailing out) & (GoTo EndOLTest1))
    ::::: Insert procedure here
    ::::: It will run only if the tested application is not running
    Echo the tested application is not running
    :EndOLTest1
    Pause at EndOLTest1
    Code:
    ::::: If I am going to bail out if a given application is not running then this is the most straightforward construction
    :: Set the image name of the application to search for
    set TestAppl=outlook.exe
    tasklist | find /i "%TestAppl%" >nul || ((Echo the tested application is not running so I am bailing out) & (GoTo EndOLTest2))
    ::::: Insert procedure here
    ::::: It will run only if the tested application is running
    Echo the tested application is running
    :EndOLTest2
    Pause at EndOLTest2

    Denis
      My Computer


  8. Posts : 15,982
    Win 10 Pro 64-bit v1909 - Build 18363 Custom ISO Install
       #78

    Martin,

    A nice piece of detective work!

    I will investigate your findings and see if they are applicable to my issue. Although my laptop is a custom install, I doubt that this has any relevance to the issue as I have never had a problem running anything before. What I do know though, it is something to do with the parameters /MT:1 and /DCOPY: DAT.

    mngerhold said:
    I found cases where people had more than one version of Robocopy on their machines (in different locations), and found that if they were (unknowingly) launching an early (say XP) version, the /MT switch was not available.
    Yes, and in Vista, instead of /DCOPY: DAT it was /DCOPY:T.

    mngerhold said:
    BTW: Why are you keen to suppress threaded copying? Why not leave the MT switch out, or accept its default of 8?
    I am actually going to leave out the /MT: parameter and use the default setting of 8, mainly because I am not really interested in the speed of the transfer/copying, as long as it does the job and it is 100% correct.
      My Computer


  9. Posts : 7,451
    Windows 10 Home 20H2
       #79

    Try3 said:
    RoboCopy /L switch
    I already knew "/L" before asking the question in post #68, but it will not give a warning automatically.
    I know I can use "usebackq tokens" to get a number, but I found the following problem.

    (Testing 1)
    Code:
    @echo off
    Robocopy "E:" "F:\# Reserved" /L /Ts /Mir /XF "desktop.ini" "Thumbs.db" 
    pause
    I ran the above in a CMD script and got the following:
    Code:
                   Total    Copied   Skipped  Mismatch    FAILED    Extras
        Dirs :         8         7         1         0         0       351
       Files :        17        17         0         0         0      2073
       Bytes :    39.7 k    39.7 k         0         0         0  195.29 m
       Times :   0:00:03   0:00:00                       0:00:00   0:00:03
       Ended : Sunday, 12 July 2020 7:12:21 PM

    (Testing 2)
    Code:
    Robocopy "E:" "F:\# Reserved" /L /Ts /Mir /XF "desktop.ini" "Thumbs.db"
    After seconds, I ran the above in a CMD window and got the following:
    Code:
                   Total    Copied   Skipped  Mismatch    FAILED    Extras
        Dirs :       353         0       353         0         0         0
       Files :      2082         0      2082         0         0         1
       Bytes :  195.32 m         0  195.32 m         0         0        77
       Times :   0:00:02   0:00:00                       0:00:00   0:00:02
       Ended : Sunday, 12 July 2020 7:12:45 PM
    No files were modified/copied/added/deleted between 7:12:21 PM and 7:12:45 PM.
    I can confirm that results of the CMD script are incorrect.
      My Computer


  10. Posts : 889
    W10-2009 19042.1348
       #80

    Paul Black said:
    I am actually going to leave out the /MT: parameter and use the default setting of 8, mainly because I am not really interested in the speed of the transfer/copying, as long as it does the job and it is 100% correct.
    I have not studied it much, but my recent reading suggests you won't get threaded (multi-file) copying without the /MT switch - that default of 8 just means that /MT is equivalent to /MT:8, I think.
      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 00:32.
Find Us




Windows 10 Forums