NetBeans - replace in textfiles under a subdirectory - file

I have troubles with replacing file contents in my current project. I renamed a directory, and a lot of class names has been changed cause of this. A want to rename this classes with netbeans, but I cannot setup the file path pattern well.
The previous directory path was: Test/TestCase under Source Files, and the new path is Test/UnitTest. So I have to rename the TestCase word to UnitTest in my php files.
I tried with *.php, it works (of course it works...), but returns every php file in the project which contains that word, and I don't want to choose from circa half thousand files the right ones. The files of the unit test system could easily contain the TestCase word...
Tried out the following patterns, but they gave empty result:
Test\UnitTest\*.php
*Test\UnitTest\*.php
Test/UnitTest/*.php
*Test/UnitTest/*.php
Test/UnitTest/*
I have not a clue what I do wrong... I tried to search a tutorial for file search patterns but have found only regex patterns and those are definitely not what I was looking for. Can anybody help me?

Lol, I checked it again, and I realized, that I didn't notice the "scope" part last time. In that you can choose the current selection instead of the entire project. So the pattern matches only the file name, not the relative path of the file...
It was so obvious... This is an epic fail, I think I was too tired...

Related

Using a batch file to copy multiple files with the same name, and past into new folder with differing names

I have a long list of files that are auto-produced every month. they'll all have the same file name, with a sequential file extension like this:file.001, file.002, file.003
Each file has differing information, despite having the same name. What I need to do is copy them from their home directory and paste them into a new directory with names that reflect their purpose, and as text files, like this: Budget.txt, Expense.txt, Retention.txt
Is it possible to do this with a batch file? I've been unable to find a method that works. Any help would be appreciated.
EDIT: I've tried that solution, and it works as far as it goes. the frustrating thing is that the extensions are not always the same, but always sequentially numbered.

How to get file name when file change is observed via watch_file

I am currently facing an issue which I don't know how to fix. I got the following Julia code:
while true
print(watch_file("test"))
end
So this should get me all the file changes in the directory named "test". At least on windows.
Now thats all well and good, and it kinda works, at least for creating a file or moving a file to that directory. This is an example of what I get:
("New Textfile.txt",Base.FileEvent(true,false,false))
But when I delete or rename that file, I don't get the filename of the file deleted or renamed.
("",Base.FileEvent(true,false,false))
Is there a different method/function I can get the filename with, even when the file is deleted or renamed? Or even better, a way that archives this and is cross-platform-compatible? Any help appreciated.
EDIT: If you could give me an alternative that supports recursive monitoring, that would be even better.
In Linux, Julia 0.4.5 and 0.4.3 watch_file returns file name always. It is a very platform-dependent feature (like in Node.js https://nodejs.org/api/fs.html#fs_caveats) and only manual polling can be truly platform-independent solution.

How do I reference a bibtex file from directory other than current project?

What I am trying to do is create a "Master" bibtex bibliography (organized via JabRef) in a convenient directory so that I do not need to copy new references from every project I work on into my master database. The issue I am coming up against is that while I can reference another file easily enough (e.g. for STATA regression table output), even if it is not in the same directory, the bibliography does not want to cooperate.
For the purposes of this example I have created a dummy directory in
My Documents/Course/Paper.
The Tex file in under
My Documents/Course/Paper/MasterTexFile.tex
and the example Tex file referenced in the code (simply called Text) is under
My Documents/Course/Text.tex.
My ideal is to have the bibliography in a more general directory altogether, but I have placed it just above the working tex file for illustrative purposes. Document code is as follows:
\documentclass[12pt,titlepage]{article}
\usepackage[round,longnamesfirst]{natbib}
\usepackage{setspace}
\doublespacing
\usepackage[margin=1in]{geometry}
\usepackage{hyperref}
\hypersetup{
pdftitle={TITLE},
pdfauthor={AUTHOR},
pdfsubject={SUBJECT},
pdfkeywords={KEYWORD} {KEYWORD} {KEYWORD},
colorlinks=true,
linkcolor=blue,
citecolor=blue,
filecolor=magenta,
urlcolor=blue
}
\begin{document}
\title{TITLE}
\date{\today}
\author{AUTHOR\\STUDENT NUMBER}
\maketitle
%Begin Document Text
\pagestyle{headings}
\section{Introduction}
\cite{Shapiro2015} %Example citation from my database
\input{../Text} %this comes from the directory ABOVE that of the current file.
%\input{../00 Master Bibliography} %This was inputted using the user interface (Texmaker). I have it here just to demonstrate that it is truly in the directory.
%References
\newpage
\bibliographystyle{plainnat}
\bibliography{../00 Master Bibliography}
%\bibliography{00_Master_Bibliography} %If the database is in the directory, everything works fine.
\end{document}
The document compiles (I use PdfLatex, BibTex, PdfLatex x2, sequentially), and properly references the Text document (which just contains the word "Text"), but I get the following errors:
Package natbib Warning: Citation `Shapiro2015' on page 1 undefined on input line 40.
Package natbib Warning: Empty `thebibliography' environment on input line 8.
Package natbib Warning: There were undefined citations.
Note: I have removed some lines of comments for brevity, so if you copy this into your editor the line numbers will be different.
These are to be expected if the database wasn't found, but I have no idea why it wouldn't be found. Does it have anything to do with natbib? Is it a feature of the natbib package that it cannot reference a database from any directory other than that of the current file? This seems unlikely.
Any help would be greatly appreciated!
Well, turns our there was a simple solution. I am not sure whether it is the '00' I had before the bibliography name (I added '00' to make sure it was at the top of the list of files in its folder), or the space between these and the word 'Bibliography', but changing the name of the file to simply `Bibliography' worked.

Copying multiple files to a Winscp directory via Script

I have a problem when trying to upload multiple files to one WinSCP directory, i can manage to copy just one single file, but the problem is that i need to upload many files that are generated by a software, the names are not fixed ones, so i need to make use of wildcards in roder to copy all of them, i have tried many variants on the code, but it all was unsuccessful, the code i am using is:
open "sftp://myserver:MyPass#sfts.us.myserver.com" -hostkey="hostkey"
put "C:\from*.*" "/Myserverfolder/Subfolder/"
exit
This code does actually copy the first alphabetically named file, but it ignores the rest of the files.
Any help with it would be much appreciated
Try this in script
Lcd C:\from
Cd Myserverfolder/Subfolder
Put *
Try and do all manually first so you can see what's going on.

How to achieve symbol referencing across directories in vim?

Can ctags tag symbols from a directory up in the hierarchy also or is it limited to create tags for current and sub-directories only?
Basically I'm looking for Visual Studio like symbol cross referencing it is very helpful in understanding alien source code flow.
If not Vim, then which other editor should I use?
thanks
Ctags only recurses to subdirectories. But all you have to do is run ctags -R . in your project home directory, and it will create a tags file for your whole project.
You aren't limited to specifying one tags file in Vim. This is an alternative to the other answers; you can just do something like:
set tags=tags,~/wintags,c:/path/to/moretags/etc
So you don't need to take the time regenerating a monolithic tags file when you just want to update your local tags.
Regarding the OP's comment in another answer,
yes thats correct but when i open a file say proj/dir1/def.c and press ctrl+] on a function name which is defined say in proj/dir2/abc.c, I get tag not found :(
You could also create one tags file for all of your projects at the 'proj' root:
set tags=tags;c:/path/to/proj
This will use the first file named tags that it finds as it walks up the directory hierarchy from where you are.
You can combine these two techniques to have a project-local tags file and then a "global" tags file that isn't updated as often.
Whilst it's got similar user interface for asking it to do it's thing, so you need to actually specify "go down directories", I find that cscope is a very nice tool, whcih does everything that ctags does and a bit more.
ctags (well, exctags at least) can create tags for as many directory trees you want. Simply run
exctags -R dir1 dir2 ...
Then vim knows about all the symbols you need. For example, one of the directories could be /usr/include in addition to your own source directory.
Make sure to run vim path/to/file.c from the same directory you created the tags file in.

Resources