Copy list using csv/txt file.


Recommended Posts

Hi All.

 

At some point in the coming months I may be asked to copy a large number of small photos from a folder to be sent to one of our clients. My problem is that it will be thousands out of around 2.5m and will be given to me in a list, probably a csv or txt file. Normally I would use Robocopy to copy this number of files but it doesn't look like it is a viable answer due to it not being a . Is there a copy tool that I can use to copy files listed in a csv/txt file to a new source?

 

Thanks for the help.

Link to comment
https://www.neowin.net/forum/topic/1197331-copy-list-using-csvtxt-file/
Share on other sites

sure. notepad++

 

Press CTRL-H to bring up the Find/Replace Dialog. Choose the "Regular expressions" checkbox near the bottom of the dialog.

To add "copy " to the beginning of each line, type ^ in the "Find what" field, and "copy " in the "Replace with" field. Then hit "Replace All".

 

then either copy and paste the contents into a batch file or save it as a batch file.

Enjoy.

 

 

 

Thanks sc302

 

Had to modify to ^(.) and Copy \1 for it to work otherwise it returned an error, "The regular expression to search is formed badly" when I hit replace all.

 

Now I have a list that starts Copy Test1.txt, how do I amend it to then include a destination?

 

I have also been looking at Robocopy again as it does seem to have the ability to state the files to copy but I cant get the syntax correct.

 

From Robocopy /? - file :: Files(s) to copy (names/wildcards: default is (*.*).

 

It only copies the last file I list.

Thanks sc302, I will look into how this will work but it should be ok.

 

Stumper66, tried your method with the following,

 

C:\Users\........\COPY TEST>FOR /F %I IN test.txt DO robocopy "C:\Users\........\COPY TEST\Source" "C:\Users\.........\COPY TEST\Destination" %I
 
And got this with no files copied,
 
test.txt was unexpected at this time.
 
What should the test.txt look like? Currently I have tried one entry per line and all on same line separated with a comma but neither work. I also had the test.txt file in both the COPY TEST folder and the source folder and it doesn't seem to like it.

not sure why you would want to use robocopy in this use case? I am a fan of it to be sure, but wouldn't it be easier to use a command that supports a file list directly?

Are you putting that command in a batch file and running it, or just using it on the command line? So if you put it in a file you would need to change to %% vs %

Question - are all the files in the sources folder, no sub folders? So there are 2.5 million files in this one folder? Do any of these files have spaces in the names?

So I did a test without any spaces in names or subfolders.

post-14624-0-47870500-1390312384.png

So my list.txt is in c:\temp the folder I was actually running the command from - you need the () around it. Off the top not sure how you could get around sub folders in your source? Spaces in the names you might be able to get around with "'s in the textfile and using /F tokens= option..

Other than that you could have lists and run the command for every source folder... But as you can see list.txt is just list of the file names.

Perfect (almost) Budman.

 

All photos are in the single folder, no subfolders and no gap in names.

 

I had attempted the command earlier but didn't include the ()'s so hit an error, didn't occur to me they were required.

 

I also added /LOG+:log.txt but the log creates an entry for each file copied appended to a single file, do you know if it can be modified to show a summary for all in one entry?

Summary would work if it was one robocopy command, but the way that loop works is your calling robocopy each copy, that my point of maybe using something else that supports lists (off the top not sure what).

But in this case your just looping a call of robocopy source dest file, each time.. So sure you could append to the same file, but see in my above screen shot how you get a summary of the dig copy, above that is the summary of each file that was copied before.

If you copied all the files in one call of robocopy then you would get a summary of what robocopy did.

As to 2.5m files in 1 folder -- man that must take for ever to come up in explorer ;)

No problem.

If and when they want the pictures and the log they can use CTRL+F to see if the file they are looking for has copied.

I asked them to change the structure to one folder per month but for what ever the reason was it didn't happen. The previous 2003 R2 box used to completely hang if we tried to do anything with this folder, even a simple right click!

Thanks again, we are going to test this with a large number of files and see how it copes but what I have been testing with so far works perfectly.

  • 1 year later...

Is it possible to post the complete code to batch copy image filenames using txt file or excel file one column image filename and 2nd column with the destination folder. A subfolder within source folder. batch or whatever program that will allow me to do this quickly. Would appreciate, the help! Thanks!

This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Posts

    • Some AMD Ryzen users can get free Windows performance boost with this simple system tweak by Sayan Sen AMD understands that there is a lot of demand for its X3D processors and for good reason too, since they offer some of the best gaming experiences. As such, the company plans to launch a new 6-core Ryzen 5 9600X3D for those who may not want to spend top dollar on a 9800X3D. What makes X3D special is the densely packed last level cache (LLC) wherein the L3 (level 3) cache is 3D die-stacked such that there is a whole lot of it that the cores can access on demand all within the smallest footprint. This is said to help with latency especially, and games happen to be quite sensitive to it since they are a mixed workload and so there is a lot of to-and-fro. However, despite that fact, users have noticed micro-stuttering and freezes on Ryzen X3D CPUs. Although there is no official fix, some of the affected users have managed to resolve the issues by tweaking a motherboard setting. The tweak is related to a setting called "GLOBAL C-STATE CONTROL" (it may be called something else by your motherboard vendor) and changing it to 'Enabled' from 'Auto' could fix stuttering and lag-related issues in games. If you are not familiar with them, Processor Power Management is done through Advanced Configuration and Power Interface (ACPI) P-states or C-states. While P-states or performance states handle CPU voltage-frequency scaling, C-states deal with CPU sleep states so that some of the CPU functions, which are not necessary at that moment, are disabled. The P-states and C-states work together to make the processor run more efficiently. It helps the OS and apps determine which cores can be parked. The Global C-state control setting helps users manage not only the DF and CPU core C-states but also the I/O C-states too. For those wondering, DF here refers to Data Fabric or AMD's high bandwidth Infinity Fabric interconnect between CPUs, GPUs, and more, on AMD systems. By default, this is set to "Auto" which also means that it is "Enabled" by default. However, in the case of X3D parts, Auto may set this setting to "Disabled" and thus manually toggling it to "Enabled" may be necessary. X3D processors, the dual CCD (core complex die) ones especially, have their V-cache on a single CCD. If the CPPC (Collaborative Processor Performance Control), which lets an OS like Windows control the "preferred core" and clock speed boost, isn't working optimally to assign the correct gaming CCD, then this fix could well work. Global C-State Auto: Global C-State Enabled: We ran a benchmark on our Ryzen 9 9950X3D to see if toggling the settings would make a difference, and well, it didn't in the case of AIDA64. However, since this is a synthetic test that measures cache and memory exclusively, we can't definitively conclude that the fix will also not make a difference in the case of games. Another remedy for stuttering is to disable the monitoring of the "Power percent" metric on MSI Afterburner if you have it on. This has been a long-known issue and in fact can help you even if you are not using an X3D CPU. Source: Reddit (link1, link2) via YouTube
    • I only have one contact on WhatsApp. And that contact has sms also. I have many more contacts that use WhatsApp also, but everyone defaults to use iMessage, SMS or RCS anyway. Not a loss for me. I'm in Norway where mostly nobody uses WhatsApp.
    • Apple is boring for a kid. Only fun is browsing websites for HTML games. A PC with steam is another story. Of course if the child plays video games all day then maybe that might not be a good idea. :-)
    • Looking for a specific setting in Settings? Sorry, the option just doesn’t exist as you’d need to elevate for that. Want to do something quickly and efficiently? Nah, forced to use a “modern” interface which takes far longer to achieve what you’re looking to do. (Example: disable a NIC)
    • Yet the best laptop for all day battery life is a Mac, hands down, no contest. Windows is bloated and power management is rubbish. Search indexer. Defender. Malicious Software Removal Tool. Windows Update (+DISM). Office CTR. Telemetry. Disclaimer: I own a surface laptop studio, multiple gaming desktops, server, and a macbook pro.
  • Recent Achievements

    • One Month Later
      DecaffKnight94 earned a badge
      One Month Later
    • Dedicated
      S.P earned a badge
      Dedicated
    • One Month Later
      adxnksd42031 earned a badge
      One Month Later
    • Rising Star
      aphanic went up a rank
      Rising Star
    • Contributor
      GravityDead went up a rank
      Contributor
  • Popular Contributors

    1. 1
      +primortal
      663
    2. 2
      ATLien_0
      261
    3. 3
      Michael Scrip
      234
    4. 4
      Steven P.
      161
    5. 5
      +FloatingFatMan
      151
  • Tell a friend

    Love Neowin? Tell a friend!