Robocopy novice needs help!

Page 1 of 2 12 LastLast

  1. Posts : 88
    Windows-7 Pro
       #1

    Robocopy novice needs help!


    I need help getting started.

    I want to mov all the jpg files on drive c: to a file named Test on drive f:

    Since I'm wanting to use the mov function, I want all the jpg files erased from the c: drive once they are written to the f: drive.

    I have tried many variants with no success, like robocopy c:\ f:\Test *.jpg /mov

    Please help me correct this command and in turn help me understand robocopy better.
      My Computer


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

    Just do be clear, "Test" is the name of folder, right? You said file but I assume you want to move the jpg files from C: to F:\Test, Is that correct?

    Could you also tell me if you want to traverse subdirectories on C: or do you only want to move the JPG files on the root of the C: drive?
      My Computers


  3. Posts : 88
    Windows-7 Pro
    Thread Starter
       #3

    Test would be a folder name and I would like to mov all the jpg files in any folder on the c: drive.
      My Computer


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

    Mike Lynch said:
    Test would be a folder name and I would like to mov all the jpg files in any folder on the c: drive.
    Great - One more question. Sorry, forgot this one earlier...

    Do you want to create the original folder structure on the source in the destination?

    Example: On C: you have a folder called C:\MyFolder. Inside that folder are JPG images. Do you want robocopy to create the "MyFolder" under F:\Test or just drop the JPGs right into F:\Test?
      My Computers


  5. Posts : 88
    Windows-7 Pro
    Thread Starter
       #5

    Just drop them into Test.

    My ultimate objective is to be able to read about 100 plus hard drives for old family photos and depositing the jpg photos into a single file on an external drive, while deleting the original jpg photos from the original drives.
      My Computer


  6. Posts : 4,163
    Windows 11 Pro, 22H2
       #6

    Okay, that's going to be a little more difficult because robocopy will usually want to create the folder structure, so way may have to create a batch file with a recursive loop.

    Bear with me a little while I see if I can figure something out.
      My Computers


  7. Posts : 18,034
    Win 10 Pro 64-bit v1909 - Build 18363 Custom ISO Install
       #7

    Hello @Mike Lynch,

    This may help with the different RoboCopy parameters [ with CMD thrown in for interest ] available . . .



    > RoboCopy - DocsMicrosoft
    > RoboCopy - TechRepublic
    > RoboCopy - SS64

    NOTE:- To view RoboCopy Commands in a CMD Prompt, type robocopy /? and press Enter.

    To output the Commands to a .txt file, type robocopy /? > %UserProfile%\Desktop\RoboCopy.txt. Obviously change the output Path to your own.



    > CMD Prompt - Copy - DocsMicrosoft
    > CMD Prompt - How to Copy Files in CMD Prompt - WikiHow



    I hope this helps.
      My Computer


  8. Posts : 4,163
    Windows 11 Pro, 22H2
       #8

    Okay, I'm not aware of a single robocopy command that will do that for you. So, since we need to create a batch file anyway, why not simply use the MOVE command since all you are doing is moving files?

    You can try the following:

    for /r "C:\" %%a in (.) do (
    pushd %%a
    move /-Y *.jpg F:\test
    popd
    )


    Just place that into a batch file and run it.

    NOTE: Be aware that I placed a "/-Y" switch in the move command. This way, if you come across a duplicate file name, you will asked if you want to replace the file or not.

    As an example, suppose that you have two different folders each with a file called Image1.jpg. You can't copy both of them to F:\Test because you cannot have duplicate filenames. If you are asked if you want to replace a file, just be aware that you will lose the first file if you respond "Y" (yes). Since the original will have already been deleted that would be a permanent loss of that file then!

    I ADVISE CAUTION

    I tested this on a set of test folders on my system, and it worked, so I am reasonably sure that this should be fine, but you may want to have a backup in case something goes wrong since I've done no real heavy testing on this
      My Computers


  9. Posts : 17,041
    Windows 10 Home x64 Version 22H2 Build 19045.4170
       #9

    Mike,

    Mike Lynch said:
    Just drop them into Test.
    Mike Lynch said:
    My ultimate objective is to be able to read about 100 plus hard drives for old family photos and depositing the jpg photos into a single file on an external drive, while deleting the original jpg photos from the original drives.
    Aren't you going to have photos that, for one reason or another, were given the same filename despite being different photos?
    Unless you are certain that that will not happen, I suggest you play safe [and ease H's burden in helping you] by allowing the photos to be stuck in various subfolders matching those that they were found in.

    This will not hinder your further processing of the files. You'll be able to search on the whole folder structure on F:\ and start moving/copying the files into the folder structure you want [just as soon as you've made a backup of the whole lot].


    Mike Lynch said:
    I want to mov all the jpg files on drive c: to a file named Test on drive f:
    I'm also concerned about your source selection.
    The photos of interest are not going to be the only .jpg files on the computer. They breed like rabbits. There are thousands of them of them that have been made by Windows & your applications without your involvement.
    Couldn't you narrow it down to particular folders such as C:\Users\%UserName%?


    Best of luck,
    Denis
    Last edited by Try3; 02 Feb 2023 at 15:47.
      My Computer


  10. Posts : 4,163
    Windows 11 Pro, 22H2
       #10

    Denis, brings up really points.

    I noticed that in post #5 of this thread, you once again that you would like all the files in a single FILE. I need to be a little insistant that you please clarify because it makes a world of difference. If you want to drop all files into a single file, like a ZIP file, we can do that. However, if you want them in a folder, that's another story. Note that since you specified that F:\Test is a folder, that's what I went with.

    NOTE: If there are concerns about duplicate filenames, you could fancy up the batch file to look for instances of duplicate names and auto-rename files, but that's a whole other ball of wax.
      My Computers


 

  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 22:02.
Find Us




Windows 10 Forums