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

Page 1 of 2 12 LastLast
  1.    #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 ComputerSystem Spec

  2.    #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 ComputerSystem Spec

  3.    #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 ComputerSystem Spec

  4. Ztruker's Avatar
    Posts : 8,189
    Windows 10 Pro X64 1903 189362.439
       #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 ComputersSystem Spec

  5.    #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 ComputerSystem Spec

  6.    #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 ComputerSystem Spec


  7. thomaseg1's Avatar
    Posts : 1,279
    Windows 10 Professional (x64) Version 1903
       #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 ComputersSystem Spec

  8.    #8

    hsehestedt said: View Post
    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: View Post
    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 ComputerSystem Spec

  9.    #9

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

  10. Ztruker's Avatar
    Posts : 8,189
    Windows 10 Pro X64 1903 189362.439
       #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 ComputersSystem Spec


 
Page 1 of 2 12 LastLast

Related Threads
Hello, I know there a multiple tutorials online about copying files from one place to another using command line. My question is, I want to copy one folder to another folder, only thing is I want the files inside it to be replaced directly,...
Hi, I have a text files containing a list of file names and I wish to compare that to a folder with files in it. The folder contains a rather large number of files and I want to see if files in that folder exist in the file with the list of file...
I want to be able to backup files and folders onto an external drive without them being combined into some sort of Windows image file, like Backup and Restore Windows 7 feature does. The File History backup does what I want, but I don't want to keep...
Backup single file in folder in Backup and Restore
Hi Is there any simple way, not involving 3rd party software to get File History to backup a single file in a folder? I'm trying to backup the Google Chrome bookmarks file, the file itself is about 1k but it's in a folder with 1Gb of files...
I want to use a single folder as a base for file compare but scan the whole computer for like or same file/folder names.My archive folders are as fragmented as my mind. 0-o
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 02:20.
Find Us