How do I replace all files in a folder with a single file

Page 1 of 2 12 LastLast

  1. zx1
    Posts : 3
    Windows 10
       #1

    How do I replace all files in a folder with a single file


    Hey!

    I've been needing to do something for a while but I'm really struggling to get it done automatically. This also might sound really confusing because it's quite hard to get it into actual words, it makes sense in my head but its impossible to communicate.

    Basically, I have a folder full of files with different names and each file is different, none are the same. What I need to do is replace every single one of those files with one singular separate file in a different folder so all the files in the previously mentioned folder have been replaced with this one file and are the same, but also ensuring that all the replaced files in the original folder keep their original names so they can be read by the system properly.
    I've been doing it manually but there are over 2500 files in that folder and its taken hours of copying the name of one file in that folder, deleting the file and pasting the new file and name over to replace it.

    I just need a way to bulk replace all of these files with a single external file without having them losing their original unique names and instead having XXXX_(copy) in its place

    I really hope that makes sense because I'm on a time limit now and I appreciate any help I can get which saves me from hours of doing it manually and dying of boredom
      My Computer


  2. Posts : 1,680
    X
       #2

    I understand this:
    Basically, I have a folder full of files with different names and each file is different, none are the same.


    I have no clue what this means:
    What I need to do is replace every single one of those files with one singular separate file in a different folder so all the files in the previously mentioned folder have been replaced with this one file and are the same, but also ensuring that all the replaced files in the original folder keep their original names so they can be read by the system properly.

    So paint a picture. Here's your starting situation, depicting a folder with three files:
    FOLDER
    file A
    file B
    file C

    What will your desired end result look like?
      My Computer


  3. Posts : 582
    Windows 10 Home
       #3

    If you are trying to copy multiple files from a folder, open the folder in File Explorer, left-click the topmost file to highlight it, then scroll to the bottom, hold down the Shift key, left-click the bottom file, then right-click one of the highlighted files and select "Copy". Then open the destination folder, right-click a blank spot and click "Paste".

    Ben
      My Computer


  4. Posts : 14,046
    Windows 11 Pro X64 22H2 22621.1848
       #4

    It almost sounds like you want to create an file in another folder which is really an index of all the files in the original folder and I'm guessing you want to be able to open that index and be able to click on any entry to open the original file.

    I know of nothing offhand but I'm sure there are programs or apps that can do this. Generating the index is easy. Making it a readable, clickable index is harder.

    Edit: Some possibilities listed here: generate a readable, clickable index of files in a folder
      My Computers


  5. Posts : 4,187
    Windows 11 Pro, 22H2
       #5

    I think I have a solution but let me explain my understanding of the situation first to make sure I have this right:

    In folder1 say you have the following files:

    file1.txt
    file2.txt
    file3.txt

    In folder2 you have a file called OtherFile.txt

    You want to files in folder1 to retain the original names but you effectively want all of these files to end up holding the same content as OtherFile.txt. In other words, they will all be duplicates of OtherFile.txt but with the original file names intact.

    Is that correct?

    If so, let me know and I'll give you a solution.

    I just want to be sure I have this correct before I post my idea to solve this here. In the meantime, I'll start typing up my idea and test it to make sure it works.
      My Computers


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

    Okay, here is my solution. I'm posting now without waiting for a response because I may have to leave my computer for a while soon.

    Just to be on the safe side, I strongly suggest making a copy of the folder holding all the files that we will be altering.

    I tried this and it worked for me.

    Copy the following file to a text file and name it AlterFiles.bat (any name is fine, but with a .bat extension).

    Code:
    for %%f in ("D:\folder1\*.*") do (
    copy "D:\folder2\test.txt" "%%f"
    )
    In line 1, replace "D:\folder1" with the path to the files that you want to alter.

    In line 2, replace "D:\folder2\test.txt" with the path and filename of the file that you want to make each file in folder1 a replica of.

    Once you have made the alterations noted above, simply double-click the batch file to run it.

    How it works: For each file in the first folder, the original filename is placed into the variable %%f. We copy the file from the other folder over to this folder with the filename stored in %%f. In other words, we are basically doing a copy and rename.

    When done, ALL files in folder1 will have the original file names, but they all will have the same contents as the file in folder2.
      My Computers


  7. Posts : 13,301
    Windows 10 Pro (x64) 21H2 19044.1526
       #7

    I'm not sure what it is that you, want to do exactly, you could upload a few pictures to give us a better idea.
    If you looking for a clickable indexing program might I suggest "Everything" from Void tools.
    You could set it for indexing that one directory and be able to click on each file.
    click on the links below (either one)

    voidtools

    Ninite - Install or Update Multiple Apps at Once
      My Computers


  8. zx1
    Posts : 3
    Windows 10
    Thread Starter
       #8

    hsehestedt said:
    I think I have a solution but let me explain my understanding of the situation first to make sure I have this right:

    In folder1 say you have the following files:

    file1.txt
    file2.txt
    file3.txt

    In folder2 you have a file called OtherFile.txt

    You want to files in folder1 to retain the original names but you effectively want all of these files to end up holding the same content as OtherFile.txt. In other words, they will all be duplicates of OtherFile.txt but with the original file names intact.

    Is that correct?

    If so, let me know and I'll give you a solution.

    I just want to be sure I have this correct before I post my idea to solve this here. In the meantime, I'll start typing up my idea and test it to make sure it works.
    Yeah that is exactly what I meant, English isn't my first language so I do sometimes struggle to put these complex concepts into words. I'll give what you said a go and see if it works out

    Thanks everyone!

    - - - Updated - - -

    hsehestedt said:
    Okay, here is my solution. I'm posting now without waiting for a response because I may have to leave my computer for a while soon.

    Just to be on the safe side, I strongly suggest making a copy of the folder holding all the files that we will be altering.

    I tried this and it worked for me.

    Copy the following file to a text file and name it AlterFiles.bat (any name is fine, but with a .bat extension).

    Code:
    for %%f in ("D:\folder1\*.*") do (
    copy "D:\folder2\test.txt" "%%f"
    )
    In line 1, replace "D:\folder1" with the path to the files that you want to alter.

    In line 2, replace "D:\folder2\test.txt" with the path and filename of the file that you want to make each file in folder1 a replica of.

    Once you have made the alterations noted above, simply double-click the batch file to run it.

    How it works: For each file in the first folder, the original filename is placed into the variable %%f. We copy the file from the other folder over to this folder with the filename stored in %%f. In other words, we are basically doing a copy and rename.

    When done, ALL files in folder1 will have the original file names, but they all will have the same contents as the file in folder2.
    Yep, that actually worked perfectly. tysm!

    Again, sorry if I wasn't clear on what I wanted to do originally, in hindsight I should have probably created a diagram to simplify it a little bit. Either way I appreciate the help guys.
      My Computer


  9. Posts : 4,187
    Windows 11 Pro, 22H2
       #9

    Glad that worked! BTW, your English was very good. I was able to understand what you were looking for
      My Computers


  10. Posts : 14,046
    Windows 11 Pro X64 22H2 22621.1848
       #10

    I understand what was done but I don't understand why? I'm sure there is a reason behind this but I can't come up with one.

    Care to share why you wanted to do this, just to satisfy my curiosity? You can ignore this question and that would be fine. I just get curious some times.
      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 04:34.
Find Us




Windows 10 Forums