Did you ever tried to merge two or more files? Well If you’re a programmer, you might have tried to merge words in C++ or Python. In the same way, we can combine two or more files into a single unit. This can be possible with the help of Windows Command Prompt. In this tutorial, I will guide you how to do that. Lets divided it in two parts. In first part, we will discuss on how to merge txt files and then, we will merge two different format files with the same approach.
Merging text (.txt) files
This is one of the easiest way of merging. Here we will merge two or more text files so as to get their data in one single file. The basic logic behind this tricks is very simple.
- First of all, copy all txt files (that you want to merge) and paste them in new folder. Now rename that folder as «Files» and move it to your Desktop.
- Our next aim is to open the Command Prompt and move it to the folder location where all files are saved. For this task, we will use «cd» command. The basic syntax is — «cd [folder location here]«
- At last, we will use «copy» command. This command let you copy one or more files to a particular location. The basic syntax that we’ll use is — «copy /b *.txt final-text.txt«
Here «/b» is a parameter which indicates a binary file, asterisk (*) is a wildcard which is used to select all txt format files and «final-text.txt» is the name of new file that contains the merged data.
Now I just hope that you have a basic understanding about this tricks. To merge your txt files, follow these simple steps —
- Go to start menu and open Command Prompt (Search for «cmd.exe» or use run command).
- Now type this code —
cd C:\Users\[Username]\Desktop\Files
This will move the Command Prompt to «Files» folder that you had already saved on Desktop. Please change the username with your account name. You can find it by executing «echo %username%» code in new cmd window. Alternatively, you can find out the complete folder location from its properties.
- Finally type this copy command and press Enter button —
copy /b *.txt final-text.txt
That’s it. Now open the folder and you’ll find a new text file their (named as final-text.txt). This new file contains the text of all merged files. For example, If you’ve two txt format files having «I am a» and «Superman» words respectively then the new file will contain both these words one after another like «I am a Superman». This order can be opposite If the file containing «Superman » will come first. Then the new text will be «Superman I am a». (which is meaningless here)
You must arrange the txt files in the order of data that you want after merging. This can be done by renaming. For example, If you want any txt file to come first, rename it to «1.txt» and then rename other file to 2, 3, 4 and so on. This will automatically arrange the files one after another in your desired order.
Also Read: How to rename multiple files at once in Windows
You can also select specific files by using plus (+) operator between them. For example, If you’ve two files named as «text1.txt» and «text2.txt» then you can use this code to merge them —
copy /b text1.txt+text2.txt final-text.txt
Merging 2 different format files
You can also merge two different format files with the same approach and interesting thing is, this will help you to hide your private data. The basic syntax is same as in above code. Just change the file name and format type. For example,
copy /b file1.txt+file2.rar final-file.rar
Above code will merge txt and rar into a single file (named as final-file) that has rar format. If you’ll open this rar file, it will show all the data of file2. Now If you want to see the file1 data, simply change the format of final-file to «.txt» and open it again. Format can be changed by renaming it.
So basically, above code will hide the data of file1 in rar file and thus no one can open it expect you. You can also change this order by changing the format of final-file to «.txt». Another amazing thing that I had observed is the size of new file. The new file size will be the sum of both file sizes. For example, If the txt file above has 1 MB size (though it is very large) and rar file is of 5 MB then the size of final-file will be 6MB.
In this same way, you can also hide your videos, pdf and images content. Few other examples are as follows —
- copy /b image.jpg+compressed.rar hidden.rar
- copy /b presentation.pdf+compressed.rar hidden.rar
- copy /b video.mp4+compressed.rar hidden.rar
Note: I had combined all files with rar file only. If you’ll combine them with any other format, it may result into error or your file may not open. The easiest way to hide any file is by merging it with rar format file.
Now tell me what will happen, if you’ll merge two same format files (I am not taking about txt). Say two mp4 format videos! Will it join both videos one after another and creates a new one with their total length? No! Same thing is possible for txt files but not for other formats and instead of this, new file will be the exact copy of either video. Lets take this example —
copy /b video1.mp4 video2.mp4 final-video.mp4
Here final-video will be the same video as video1 but its size will the sum of both videos. Try other formats yourself. Although I had tried my best to make this tutorial simple but still If you’ve any doubts, please drop them in below comment box. Stay tuned for more interesting updates.
Загрузить PDF
Загрузить PDF
Из этой статьи вы узнаете, как с помощью командной строки Windows объединить несколько текстовых файлов в один новый файл. Для этого скопируйте все текстовые файлы в одну папку, а затем запустите специальную команду.
-
Меню «Пуск» находится в левом нижнем углу экрана.
- Чтобы ускорить процесс объединения, все текстовые файлы должны находиться в одной папке. Если файлы хранятся в разных папках, скопируйте их в одну.
Убедитесь, что все текстовые файлы оканчиваются пустой строкой (или разделительным символом/словом/текстом по вашему выбору), чтобы знать, где начинается каждый раздел.
-
Щелкните по «Этот компьютер» или «Компьютер» на правой панели, а затем перейдите к папке с файлами. Откройте папку — на правой панели отобразятся текстовые файлы.
-
Удерживайте ⇧ Shift и щелкните правой кнопкой мыши по пустому пространству на правой панели. Откроется контекстное меню.
-
Откроется окно командной строки, в котором активным будет текущий каталог.
- Если вы активировали Windows PowerShell, нажмите «Открыть окно PowerShell».
-
Вместо «newfile.txt» подставьте имя файла, который будет создан (например, mergedfiles.txt).
-
Будет создан новый текстовый файл с содержимым всех текстовых файлов, которые находятся в текущей папке.[1]
- Убедитесь, что новый файл включает содержимое всех текстовых файлов, а затем удалите их (если они не нужны).
Реклама
Об этой статье
Эту страницу просматривали 139 196 раз.
Была ли эта статья полезной?
Last Updated :
19 Jun, 2024
Merging or hiding files within other files using Command Prompt in Windows is a clever technique for managing and protecting your data. Whether you want to consolidate multiple files into one or conceal sensitive information, CMD offers powerful commands to achieve this seamlessly. Learning how to hide a file in another file CMD or merge files using CMD in Windows can enhance your file management skills and improve data security.
In this guide, we will walk you through the steps to hide and merge files in CMD, providing detailed instructions to combine files using CMD effectively. By mastering these techniques, you can manage your files with greater flexibility and security.
Merge/Hide One File into Another Using CMD in Windows
Step 1: Select the two Different / Similar Extensions of the file you want to merge.
Step 2: Select which file you want to show and which File to Hide.
Step 3: Keep both the file into one folder because it is easy to Understand Which file to show and which to hide.
Step 4: Compress the file you want to hide by using Compressing Tools like WinRar. Or any other tool which is easily available.
Step 5: Open the Command Prompt or CMD by pressing window + R and type CMD on the Run Box and press Enter.
Step 6: Please Enter this Command into the CMD/Command Prompt, because these commands could be different in each and every PC/ Laptop. This Command will tell the location of the folder where it is placed in the Computer.
Command: cd /d\users\Administrator\Desktop
Mearge is the name of the Folder kept / Placed on the Desktop Screen of the Computer.
Command: cd Mearge
The file available in the Folder
Command: dir /w/a
Copy the .txt file into the .zip file.
Command: Copy /b S.txt + H.zip
Step 7: After all this Process you would not able to see any type of changes into the appear file but sometimes the size of the file might get Increased, or The text format of the task may also be changed automatically.
Step 8: If you want to see the Hidden file you could use the Compress tools to view the Hidden File as follows:
Mastering the ability to hide a file in another file CMD or merge files using CMD in Windows opens up new possibilities for data management and security. By following the steps outlined in this guide, you can effectively hide and merge files CMD, ensuring your sensitive information is protected and your file system remains organized.
Его затем можно очистить от дубликатов и использовать по своему усмотрению. Всё это делается с помощью командной строки Windows (CMD). Как — рассказываем в переводе статьи Сэма Партланда для Sammy SEO.
Как открыть командную строку
Пошагово:
-
Щёлкните по кнопке со значком Windows, которая расположена в левом нижнем углу экрана и открывает меню «Пуск».
-
Введите “cmd”. Просто сразу начните вводить эти символы — предварительно нажимать на кнопки в меню или куда-то переходить не нужно.
-
Щёлкните на приложении «Командная строка».
Вы увидите пустую командную строку, которая по умолчанию установит в качестве текущего каталога ваш пользовательский каталог. Она будет выглядеть примерно так:
Как поменять текущий каталог CMD на каталог с CSV‑файлами
Для этого нужно ввести CD и через пробел местоположение каталога.
Автор статьи набирает такую строку:
CD C:\Users\sam\Box Sync\Clients\Sample CSV files
У вас может быть другой путь.
Затем нужно нажать клавишу Enter, после чего командная строка будет выглядеть так:
Текущий каталог командной строки изменился на тот, где находятся ваши CSV‑файлы.
Если вы не знаете их местоположение, можете просто добраться до этого каталога с помощью проводника Windows. Затем щелкнуть на поле в верхней части окна проводника.
В случае автора статьи окно проводника после перехода в нужный каталог будет выглядеть так:
Затем, чтобы получить возможность скопировать путь к текущему местоположению, нужно щелкнуть на поле в верхней части окна, которое на картинке выше помечено стрелкой:
Как объединить CSV‑файлы в один файл
Для объединения файлов нужно ввести команду «copy *.csv filename.csv».
Подстановочный знак * в «*.csv» позволяет выбрать все CSV‑файлы в текущем каталоге, а вместо filename — имени файла‑результата — можно ввести что угодно.
Автор вводит следующую строку:
copy *.csv all‑keywords.csv
Затем командная строка объединит все эти файлы в новый CSV‑файл с указанным вами именем.
Время объединения зависит от количества и размера файлов.
У меня был небольшой набор файлов, поэтому их объединение заняло две секунды. Даже в случае объёмных файлов их объединение должно завершиться не более чем за 10–15 секунд.
Бонус: как очистить полученный файл от дубликатов
После объединения нескольких CSV‑файлов в один нужно лишь очистить его от дубликатов. Это можно сделать в Excel или в Google Таблицах.
Как это сделать в Excel:
-
Выберите столбец с ключевыми словами.
-
На вкладке «Данные» нажмите на кнопку «Удалить дубликаты».
-
В появившемся окне проверьте, что выбран вариант «Автоматически расширить выделенный диапазон», и нажмите на кнопку «Удалить дубликаты…».
-
Нажмите на кнопку «Снять выделение», а затем отметьте галочкой столбец с ключевыми словами, чтобы очистить от дубликатов только его.
Программа удалит дубликаты среди всех ключевых слов. Вы сможете просмотреть данные либо перенести их в Google Таблицы или любой другой инструмент, которым пользуетесь для работы с ключевыми словами.
Ещё по теме
Как продвигать сайт по НЧ‑ и ВЧ‑запросам
Как пользоваться Яндекс Вордстатом
Что такое каннибализация ключевых слов в SEO и как её избежать