I would like some guide and help for this:
I have a text file with names listed in it. I will call it “source file”
I have multiple text files scattered in folders and sub folders
I would like to know how to make a script that would automatically add SPECIFIC LINE to every text file (in subfolders of chosen target folder) that contains exact name listed in “source file”
More detailed/Example:
I have a names.txt that contains many names. I want to find all the text files in target folder and it’s subfolders that contains names listed in names.txt and in those files automatically add “FALSE” line (in front or after specific existing line).
Related
I have very little experience with the command line and I'm trying to do something very complicated (to me).
I have a directory with A LOT of subfolders and files in them. All file names contain the parent folder name, e.g.:
Folder1
data_Folder1.csv
other_file_Folder1.csv
Folder2
data_Folder2.csv
other_file_Folder2.csv
In another folder (all in one directory), I have a new version of all the data_FolderX.csv files and I need to replace them in the original folders. I cannot give them another name because of later analyses. Is there a way to replace the files in the original folders with the new version, in the command line?
I tried this Replacing a file into multiple folders/subdirectories but didn't work for me. Given that I have many .csv files in the derectories, I don't want to replace them all, so I don't think I should do it based on the file extension. I would also like to note that the name "FolderX" contains several other _, so in principal, I want to replace the .csv file starting with data in the FolderX.
Can anyone help?
Thanks in advance!
I have two folders with many files of the same naming format but differing extensions. I would like to loop through the files of the first folder and extract their filenames to check if a file of the same name exists in the other folder, then create one (with the other extension) if it doesn't. I can't get a grapple on bash for whatever reason, so I was wondering if there's a simple way to do this.
Given the following text file which contains a list of directories, how would you automatically generate the file path if it doesn't exist.
apache/bin/
apache/build/
apache/error/include
apache/htdocs/images/
apache/icon/small
python/bin
python/include/python2.7
lib/pkconfig
lib/python2.7/bsddb/test
lib/python2.7/compiler
lib/python2.7/ctypes/macholib
lib/python2.7/ctypes/test
For example, from the root/start directory, if the line reads apache/bin/, I want to check if the folder apache exists, if it doesn't, then I create it.
After that I want to cd into it, check if the file bin exists, if it doesn't then I create it. Then before moving into the new line, I want to move back into the root directory (i.e. move up two levels).
How would I accomplish this in Bash?
I am looking to merge PDF files from two separate folders into a third folder, based on file name.
Directory structure:
FOLDER_1 = File set #1.
FOLDER_2 = File set #2.
MERGED_PDFS = Output of merged files.
FOLDER_1 contains a set of PDF files which could be named with any combination of letters, numbers and allowed symbols.
FOLDER_2 contains a set of PDFs with the exact same names as FOLDER_1. The data on these sheets is different. The files from FOLDER_2 need to be inserted into the files from FOLDER_1, at the end of the file.
The output of this merged file will be placed in the MERGED_PDFs folder, retaining the name used to match the files in FOLDER_1 and FOLDER_2.
Example:
FOLDER_1: R000135322.PDF
FOLDER_2: R000135322.PDF
MERGED_PDFS: R000135322.PDF
(MERGED_PDFS contains a merged PDF from FOLDER_1 & FOLDER_2, with the PDF from FOLDER_2 being placed at the end of the PDF in FOLDER_1.
I saw some similar examples of this being done with PDFtk, but unsure how to edit to get my expected output.
Thanks
Here's what you need to do:
Install FolderMill
Specify the Incoming folder and the Output folder for FolderMill on your PC
Since you mention that files in FOLDER_1 and files in FOLDER_2 have the same filenames, just add "Convert to PDF" action and select Multipage: "Append pages to existing document" in the options.
Click Apply changes
Start FolderMill by pressing the Play button.
Grab the files from FOLDER_1 and put them into the Incoming folder
Grab the files from FOLDER_2 and do the same.
Receive the merged PDFs from the Output folder
If the you are not sure if all the corresponding files have the same filenames, you may also need to use the "Rename" action.
FYI, we have a detailed step-by-step guide how to do it (with screenshots).
You are welcome :)
I'd like to create a batch file under windows to move files with specific file names. I'd like to move all the files with txt extension and filename starting with "HH", and moving them only from root, sub directories excluded. And if a file with the same name is already exist in the destination directory I'd like to auto rename files instead of overwriting. Is it possible to do?
You can simply use:
move c:\HH*.txt destination_directory