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

    • Time to find another tech news site I think. This is beyond ridiculous.
    • Microsoft Store is getting improved recommendations, deeper Windows integration, and more by Taras Buria Microsoft announced several new features coming to the Microsoft Store on Windows 11. The company revealed that 250 million customers use the Microsoft Store each month. With the latest updates, Microsoft is improving the experience with better recommendations, search improvements, deeper Windows integration, Copilot, and more. The store's Home Page is getting personalized recommendations with suggestions based on your recent activities, what is trending in your region, and the recent deals. Microsoft says this change will bring more meaningful and relevant content. Search is getting smarter, and it now uses additional information when ranking apps. It is "intent-aware," and considers additional aspects like app updates, ratings, language-specific nuances, and more. In the United States, the Microsoft Store now has a Copilot button at the bottom of the screen. Clicking it lets you ask questions about an app or game, or compare two products. Speaking of Copilot, apps with AI-powered experiences now have a badge indicating that certain apps work better on Copilot+ PCs. Other changes to the Microsoft Store include a new Discover More section with related apps and deeper Windows integration. The latter lets you find apps in the Microsoft Store using Windows Search, and the "Open With" dialog now includes additional recommendations from the Microsoft Store. Finally, Microsoft made multiple under-the-hood improvements to boost performance (the app launches twice as fast as it did six months ago) and improve installation reliability. In addition to new features coming to the Microsoft Store, the company reminded users that some popular productivity apps are now available in the Store. They include Notion, Perplexity, Docker, and Day One. You can read more about all those changes in a post on the official Windows Blogs website. Last month, at Build 2025, Microsoft announced more improvements for the Microsoft Store, so stay tuned for those.
    • OpenAI exposes secret propaganda campaigns tied to multiple countries by David Uzondu Back in February, OpenAI shut down accounts that were busy developing Chinese surveillance tools aimed at the West. These tools were designed to snoop on social media, look for anti-China sentiment and protests, and report back to Chinese authorities. Now, OpenAI has announced it has disrupted even more shady operations, and not just those tied to China. In a report released Thursday, the company detailed how it recently dismantled ten different operations that were misusing its artificial intelligence tools. One of the China-linked groups, which OpenAI called "Sneer Review," used ChatGPT to churn out short comments for sites like TikTok, X, and Facebook. The topics varied, from U.S. politics to criticism of a Taiwanese game, where players work against the Chinese Communist Party. This operation even generated posts and then replied to its own posts to fake real discussions. What is particularly interesting is that the group also used ChatGPT to write internal performance reviews, describing how well they were running their influence campaign. Another operation with ties to China involved individuals posing as journalists and geopolitical analysts. They used ChatGPT to write social media posts and biographies for their fake accounts on X, translate messages from Chinese to English, and analyze data. OpenAI mentioned that this group even analyzed correspondence addressed to a U.S. Senator. On top of that, these actors used OpenAI's models to create marketing materials, basically advertising their services for running fake social media campaigns and recruiting intelligence sources. OpenAI also disrupted operations, probably originating in Russia and Iran. There was also a spam operation from a marketing company in the Philippines, a recruitment scam linked to Cambodia, and a deceptive job campaign that looked like something North Korea might orchestrate. Ben Nimmo, from OpenAI's intelligence team, noted the wide range of tactics and platforms these groups are using. However, he also said these operations were mostly caught early and did not manage to fool large numbers of real people. According to Nimmo, "We didn't generally see these operations getting more engagement because of their use of AI. For these operations, better tools don't necessarily mean better outcomes."
    • Long ago, I was in a networking class on a lab computer. The guy next to sarcastically told me to SHIFT+DELETE the C:\Windows folder. I said that I was sure Windows wouldn't allow such a thing (Windows 2000), and would either totally block the action or give some kind of dire warning. I was so confident that I tried it...not only was I wrong, but it didn't even give the standard "are you sure" warning, just went to town. I pressed cancel as quick as I could, but it was too late, shortly after, the system blue-screened and never booted again. I had to stay late and reinstall Windows for the teacher, but that ended up being a good thing, had great repour with him for the rest of the year, even got to help him get Active Directory setup in his lab.
  • Recent Achievements

    • One Year In
      survivor303 earned a badge
      One Year In
    • Week One Done
      jbatch earned a badge
      Week One Done
    • First Post
      Yianis earned a badge
      First Post
    • Rookie
      GTRoberts went up a rank
      Rookie
    • First Post
      James courage Tabla earned a badge
      First Post
  • Popular Contributors

    1. 1
      +primortal
      419
    2. 2
      snowy owl
      182
    3. 3
      +FloatingFatMan
      182
    4. 4
      ATLien_0
      176
    5. 5
      Xenon
      137
  • Tell a friend

    Love Neowin? Tell a friend!