I do not know what it is called but this is what I am wanting to do. Imagine that you have a directory named (program) then you have three other directories beneath that named 1,2,3. Each of these have 10 files in them either in python or php or what ever.
What I am wanting to do is change a little bity bit of code in each one using a find and replace in notepage ++. Is there a way to basically have every file combined for this one find and replace then when you are done just save it and have them go back into the individual files and directories like before. Is this even possible, has anyone even wanted to do this?
Related
I need something that can copy a specified file any and everywhere on my drive (or computer) where that file already exists; i.e. update a file. I tried to search this site, in case I'm not the first, and found this:
CMD command line: copy file to multiple locations at the same time
But not quite the same.
Example:
Say I have a file called CurrentList.txt, and I have copies of it all over my hard drive. But then I change it and I want all the copies to update. So I want to copy the newer one over all the others. It could 'copy if newer', but generally I know it's newer, so it could also just find every instance and copy over it.
I was originally going to use some kind of .bat file that would have to iterate over every folder seeking the file in question, but my batch file programming is limited/rusty. Then I looked to see if xcopy could do it, but I don't think so...
For how I will use it most, I generally know where those files are going to be, so it actually might be as good or better if I could specify it to (using example), "copy CurrentList.txt, overwriting all other copies wherever found in the C:\Lists folder and all subfolders".
I would really like to be able to have it in a context menu, so I could (from a file explorer) right click on a file or selected files and choose the option to distribute it.
Thanks in advance for any ideas.
Use the "replace" command...
replace CurrentList.txt C:\Lists /s
I need to check the files of a versioned system. To do that, I need to write a batcha program so to compare the contents of several folders containing the repositories.
So, my question is: how can I "read" the names of all the subfolders inside a folder, so to use these names later to find subfolders having the same names in a different repositories?
I suppose I may use DIR to print on the screen a list of these names but I don't know how to write it on a text file and then read it. Moreover, I should edit this kind of list, anyway.
Any suggestions or new ideas to solve this problem?
I thank gratefully who ever will answer.
it seems that you can get the subfolders using batch file from perl as follows:
system("start C:\\Temp\\mybatchfile.bat");
or you might try to pass your command suggested by #Stephan straight to system and try to handle what it is returned.
First off I want to say that
-I didnt ever create a batch file yet, but I am really willing to learn
-I am not even sure if what i want to do is possible with a batch file
What i want to do is the following:
I want to replace a number of files of one file type in a folder each with one and the same file of another file type. In doing this, i want the "replaced" files to keep their original name except for the "replacer" file's extension. I am not talking about file conversion, this is about replacing several different files each with one and the same file, so each of them will look the same later, just with different names and the file extension of the "replacer" file. All of the files inside the folder are to be treated this way, there are no exceptions.
So it looks something like this:
Folder 1 Folder 2
10000000.tga------------->10000000.png (looks like replacer.png)
10000001.tga------------->10000001.png (looks like replacer.png)
10000011.tga------------->10000011.png (looks like replacer.png)
I really hope that my description is sufficiently precise, if not so, I am of course willing to give any information needed. I found parts of what i need (e.g. a loop for files in a folder, an order to replace one file with another file) but I am unsure of how to combine them at all, let alone to achieve what I actually wanted to do.
Any help is greatly appreciated :)
for %%i in (*.tga) do (
copy "replacer.png" "%%~ni.png"
del "%%i"
)
see for /? for details about the %%~.. syntax
I've been doing a little research, and I haven't find anything remotely similar to what I'm looking at, so here's my case:
I have a folder, lets name it MasterFolder
So, lets say that my MasterFolder, has inside of it, four more folders, I know I can use
cd C:\MasterFolder\
to leave my CMD console just on top of those so, for didactic meanings, lets call them:
- Folder_A
- Folder_B
- Folder_C
- Folder_D
So, inside each of those folders, there are even more folders, that are named
"EncodingMaster_Originals"
the name is the same for all, so, that way, we could say that the folders are, for example:
- Folder_A\EncodingMaster_Originals (and OTHER files that I won't delete)
- Folder_B\InsideFolder_B\EncodingMaster_Originals (In another folder inside Folder_B
Those two are the most simple examples.
So, what I want to do?
Well, is simple, I just want to delete the folder named
"EncodingMaster_Originals"
from each of the folders, without having to be going into each one (There's around 200 folders with those little ones inside, I've made some massive re-encoding of files, and those folders appeared from nowhere).
I think that I've to use this line of code:
rd
(the Remove directory command), but my problem is that I don't know what I have to tell to the RD command, I don't want to look more dumb so I won't type what I've tried, because it was obviously wrong.
If you could help me, I would appreciate it.
So, after a brief search with a different bunch of words. I found THIS post:
How to remove all folders of name x within a directory using cmd/batch file
And the answer is this comment:
https://stackoverflow.com/a/10399706/4625105
Thanks if you were about to answer, I think the case is closed.
I was wondering if there is a tool or method to check which files have been modified in multiple directories. I have a copy of the files in the same directory structure that I am sure it was not touch and another that is the one I want to check against the first one. I know diff is out there for that, but I just don't want to check one file at the time.
Thank you.
diff -ru <fist_dir> <second_dir> should do it.