I need to remove the first 4 characters of the names of over 100 files in a certain directory, can I do this with an obj-c program or a c ++ program and if so how?
Yes you can.
The NSFileManager class provides all the methods you need.
To get the contents of the directory use the contentsOfDirectoryAtPath method.
To rename the file you need to use the moveItemAtPath method.
Take a look at the class reference https://developer.apple.com/library/mac/#documentation/Cocoa/Reference/Foundation/Classes/NSFileManager_Class/Reference/Reference.html
Steps:
1. Get the names of the files in the dir.
2. Iterate all the files and use the moveItemAtPath to rename.
Related
For certain project I want to make statistics like list of public methods and functions. Great option might be using CppDepend and it's build-in query language.
Our (legacy) project base has applications. Each application is in it's own directory, has project file and some subdirectories with sources. Certain subdirectories are shared in multiple applications (using svn:externals). My goal is count methods and functions in such shared directories only once.
For example if file my_file.h contains three functions and is checked out to three different local directories I still want to add only 3 to my statistic and not 9.
Is there a way to tell cpp what directories/files are checked out to multiple local directories to count them only once?
To avoid counting the same methods you can add the distinct filter to the cqlinq query like this:
from m in JustMyCode.Methods.Distinct(m=>m.FullName)
select m
So each method will be counted once, or you can improve the query to avoid filtering methods with the same signature but are not the same by adding a filter of the source file name
from m in JustMyCode.Methods.Distinct(m=>new {m.FullName,m.SourceDecl.SourceFile.FileName})
select m
I've read several batch renaming answers, and haven't made them work for my application. My regex and loop skills are weak.
I need to move many files with the same name, let's say non_unique_file.txt from directories with semi-unique names such as 'Directory#1/' or 'Directory#2/' to the 'non_unique_files/' directory, while modifying their name so it contains the unique identifier from the directory of origin. If I were to move just one file, it would look like:
cp Directory#1/non_unique_file.txt non_unique_files/#1.txt
I tried several loops such as:
for f in Directory* ; do cp $f/*txt non_unique_files/$f ; done
knowing that it was not exactly what I needed, but I don't know how to parse the original directory names and add that to the new file names, in the new directory.
Any help/resources would be appreciated.
Figured it out. Not certain how this is working but it works.
for f in Directory* ; do cp $f/non_unique_file.txt non_unique_files/$f"".txt"" ; done
Where my files get renamed to 'Directoy#X.txt' in my non_unique_files/ directory.
I want to extract dates from the suffixes of files in a particular folder. The contents of such a folder look something like:
Packed_Folder_1_2016.06.10
Packed_Folder_1_2016.08.06
Packed_Folder_1_2015.09.03
packed_Folder_1_2015.01.08
... (so on and so forth, always in the same path just different suffixes)
There is no pattern to the dates. I need to make a VS form (2013) to read the name of the files and store the date differences.
Notice how the filenames always follow a pattern? It's always Packed_Folder_1_####.##.##, where the last part is a date.
So what you want to do is list the file names in the folder, and try to find a file that matches the pattern. You could use a regular expression to match the filename (it would be something like R"(Packed_Folder_1_\d{4}\.\d{2}\.\d{2})").
You are talking about Forms, so I am assuming you are able to use Visual C++. If that is the case, you can check FileSystemWatcher Class.
You instantiated it with a given path ( file or directory ), and it will trigger events based on some changes on the target (simple change, creation, rename - you can select which one). You could then update your reference, in case its change suits your needs.
I have a large C++ software application documented with doxygen. How can I set it up so that I can generate subdocuments for specific classes? The classes are documented with in-source commenting, their own .dox files, and images/ directory. I need to be able to generate a standalone pdf file specific to a single class.
I can use grouping to identify what will be included in that subdocument, but how do I generate output for a single group?
If you have a specific .dox file per requested output entity, then all you need to do is define in that file as input the files declaring and defining that class.
Say for example you want an output only for class MyClass which is declared in file myclass.hpp and whose implementation is in myclass.cpp, then in myclass.dox, just add this:
INPUT = ./myclass.cpp \
./myclass.hpp
Of course, you can have different paths for .cpp and .hpp. Or you can document more than one class.
Then, run doxygen on that myclass.dox file.
Also watch out for the output folder name. For the html output, the default name is html so you might want to rename it to avoid mixing up all the different outputs. For example, you might want to add in the dox file something like:
HTML_OUTPUT = html_myclass
I am using gate 7.1. in that i have 30 .def files are loading every time.
I have run multiple text files every time all 30 .def files loading if any possibility to load all 30 .def files into single object and send that object to gazetteer.
add multiple def files at a time to anniecontroller
Vijay,
I do not believe it is possible to load def files within a single def file.
The Definition (or Index) file specifically references a list (lst) file. List files reference terms, majorType, minorType, language, and the list display name.
For example:
testList:majorType=Major Type:minorType=Minor Type
The resulting .def would look like:
testList.lst:Major Type:Minor Type:English: Test List
The definition file can only contain list file references. That being said, You can alter the structure of the definition file to meet your needs. There are several different way to do this, all permutations of the same concept.
Add all lists under one def file with each list having a different label,
Build a small set of def files with related lists,
Build a larger set of def files that evolve from other lists.
Question is, what are you trying to do?
Yes , It is possible to load multiple def files . You can do it by using annie plugin .So , First you have to load that plugin from CREOLE option.Select ANNIE from it .
After that, you can select Annie Gazetteer as a processing resource. Then their, you can add multiple def files paths, where you just need to give the paths of def files.