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

    • Another win for EU users? Ads in WhatsApp won't be coming this year by David Uzondu You might have heard that ads are making their way to WhatsApp after years of the company promising it would never happen. If you are in the EU (lucky you), you won't be seeing ads until 2026 at the earliest. A new report from POLITICO confirms that Meta, which owns the messaging service, has informed Ireland's privacy regulator that the new advertising model will not roll out in the European Union for quite some time, even as it appears elsewhere in the coming months. This is not some charitable act, of course. The delay gives European regulators time to scrutinize the plan, which involves using ad preferences from linked Facebook and Instagram accounts to target users. This situation follows a pattern of other "wins" for EU users, like the changes in iOS 17.4 that finally enabled sideloading. This opened the door for alternative app stores and the (temporary) return of games like Fortnite to iPhones in the region. Similarly, we are seeing Microsoft finally back off from shoving Edge down the throats of EU users, all thanks to the Digital Markets Act. This legislation has put pressure on big tech companies to operate more "fairly" within the bloc, leading to changes that users everywhere else can only dream of for now. These regulations are precisely what companies like Apple hate. Remember, Apple has issued a warning to Australia, telling the country not to follow Europe's lead on these matters because it would create massive security and privacy risks. Apple argues that its control over the ecosystem keeps users safe, so any attempt to break that open is dangerous. The Irish Data Protection Commission will be meeting with WhatsApp to discuss the matter further. According to Commissioner Des Hogan, they plan to discuss the ad model with other European data protection authorities to gather any collective concerns. Commissioner Dale Sunderland noted that discussions with the company are "still early days", and it is too soon to identify what, if any, specific "red line issues" might exist with Meta's advertising plans. For now, Europeans can continue using their ad-free messenger, while the rest of the world prepares for the inevitable.
    • Welcome to Neowin!
    • Idiots never imagine their insane actions troubling everyone.  
    • Photo Variants 2.3 by Razvan Serea Photo Variants is an all-in-one photo editor for Windows. Quickly cull, import, and edit your images with powerful tools. Enjoy full layer support, precise retouching features, and a wide range of filters and color adjustments. Create multiple versions of a photo instantly with presets, or design from scratch using vector graphics and advanced editing options. Free for personal and commercial use. Photo Variants key Features: Advanced Adjustment Tools: Provides precise control over image modifications. ​ Extensive Filter Collection: Offers over 99 photo filters to apply various effects. ​ Animated Photo Effects: Enables the addition of dynamic elements to images. ​ Automatic Face Retouching: Includes features for enhancing facial features automatically. ​ Support for Multiple Formats: Compatible with over 100 graphic formats, including RAW and PSD files, allowing users to open, edit, and save in these formats. ​ Drawing and Transformation Tools: Facilitates freehand drawing, erasing, filling, cropping, resizing, rotating, and flipping images. Photo Variants supports a wide array of image formats, making it a versatile tool for all your editing needs. Key supported formats include: Raster Formats: .jpeg, .jpg, .png, .bmp, .gif, .tiff, .webp, .ico, .pcx. Camera RAW: .crw, .cr2, .dng, .nef, .raf, .arw, .orf, .x3f, .raw. Professional Formats: .psd, .ai, .svg, .tga, .pdf, .pcl. Specialized Formats: .dicom, .dcm, .heic, .heif, .avif, .exr, .dds. Other: .wmf, .emf, .xps, .jpeg2000 (.jp2)...etc... With support for these formats, Photo Variants offers seamless editing and flexibility for photographers, designers, and creatives. Photo Variants 2.3 changes: New effects for layers. New shapes and options for brushes. Download: Photo Variants 2.3 | 70.5 MB (Freeware) View: Photo Variants Home page | Screenshot Get alerted to all of our Software updates on Twitter at @NeowinSoftware
    • Internal PSU for these applications is bueno. External would be prone to noise and that is exactly something you do not want.
  • Recent Achievements

    • Week One Done
      Wayne Robinson earned a badge
      Week One Done
    • One Month Later
      Karan Khanna earned a badge
      One Month Later
    • Week One Done
      Karan Khanna earned a badge
      Week One Done
    • First Post
      MikeK13 earned a badge
      First Post
    • Week One Done
      OHI Accounting earned a badge
      Week One Done
  • Popular Contributors

    1. 1
      +primortal
      692
    2. 2
      ATLien_0
      269
    3. 3
      Michael Scrip
      204
    4. 4
      +FloatingFatMan
      170
    5. 5
      Steven P.
      144
  • Tell a friend

    Love Neowin? Tell a friend!