This question already has answers here:
Rename files and directories recursively under ubuntu /bash
(8 answers)
Closed 5 years ago.
I am using this command to replace a word with another in many filenames (batch):
rename 's/oldname/newname/g' **
But it works for the current open folder only. I am not sure how to make it work for that directory and all the sub-directories.
Thanks.
Mike,
Try this: Create new folders, move files, delete old folder. Then, move over directories.
Regards
Related
This question already has answers here:
How do I add files without dots in them (all extension-less files) to the gitignore file?
(3 answers)
Closed 2 years ago.
What would be the format for excluding files that do not have an extension, such as runme, which does not have an extension. For example, if the files in my directory are:
script.sh
script.s
runme
I want to exclude the files without an extension. I suppose the regex for this would be ^[^.]+$. How does this go into a .gitignore though? What are the regex (or is it more unix/shell filepath matching patterns)?
The gitignore file format doesn't support regular expressions, just regular Unix-style patterns.
In your case, I would exclude everything and then allow the files that do have an extension. For example:
# Ignore everything
*
# Allow directories
!*/
# Allow files with an extension
!*.*
This would include files like these:
foo.txt
some/dir/bar.txt
But exclude files like these:
foo
some/dir/bar
This question already has answers here:
Get path of executable
(25 answers)
How do I get the directory that a program is running from?
(26 answers)
Finding current executable's path without /proc/self/exe
(14 answers)
Closed 2 years ago.
Is there a way to set the output directory of a file in the same one where the executable is located and not where the executable is executed?
ofstream outputFile;
outputFile.open("text.txt");
outputFile<<"test";
When I click on the .exe it typically outputs the file in the same directory I started it but when I execute it in different ways say for example with a .BAT file, the output directory is automatically set where I started the .BAT file (not where the .exe is located)
This question already has answers here:
In CMake, how can I find the directory of an included file?
(4 answers)
Closed 4 years ago.
I'm writing a .cmake file that handles a bunch of stuff and needs access to an executable in a fixed relative path to the .cmake file. In this instance, the orgianization looks like this:
CMakeLists.txt
- cmake
- tools.cmake
- bin
- exectuable.exe
The issue is that tools.cmake is included using include and thus, CMAKE_CURRENT_SOURCE_DIR returns the directory of the CMakeLists.txt. The reason I don't want to hardcode the path is that I want to put the tools.cmake and binary in a separate GIT repository and I don't want to force the user to place it in some specific folder.
Only solution I can come up with right now is to supply a function that sets and stores the path to tools.cmake. That's not really elegant.
Answered here: https://stackoverflow.com/a/12854575/2532768
CMAKE_JUCE_TOOLS_PATHdoes not return the correct path within functions or macros in tools.cmake but it results in the correct path outside any function. So one can us
set(PATH_TO_TOOLS_CMAKE ${CMAKE_JUCE_TOOLS_PATH})
to store the path while it can be accessed in a variable and than access PATH_TO_TOOLS_CMAKE in functions and macros
This question already has answers here:
How to include package data with setuptools/distutils?
(14 answers)
Closed 6 years ago.
Is it possible to include a csv file as part of python package?
I am creating a package and want some default config files which are imported at runtime.
I know I can store as a list or other structure in a .py file, but this will break the pattern I'm building against.
This can be done in a two-step process, as detailed here.
You need one file in the root of your source, MANIFEST.in which reads:
include path/to/yourfile.csv
and you also need to add include_package_data=True, to the setup() function in setup.py.
Tried and tested.
I guess that you may use a specific module more than an "homemade version" to store configuration.
In your case:
The Python standard library includes the ConfigParser module, which handles ini-style configuration files for you.
This question already has answers here:
Closed 11 years ago.
Possible Duplicate:
How to remove a non-empty directory in C++?
I have the directory name. i am trying remove(dir_name), but as the directory is not empty its returning false.
How can i delete the directory. Is there any built-in function which i can call??
To recursively remove a directory and all it's contents, use the following command in a terminal:
rm -rf /path/to/dir
Edit: Seems I was confused by your mention of built-in function, I was assuming a function "built into" linux. Obviously this is not C++ code. If that's what you want, see the question linked to in Fred Larson's comment to your original question.