gnus: nnmaildir (maildir) with with subfolders tree - emacs

I have configured gnus to use nnmaildir with ~/Maildir directory. Gnus sees/lists maildirs in direct sub-folders (e.g. ~/Maildir/archvives/) but it does not see/lists maildirs in deeper subfolders e.g. (~/Maildir/archives/2015/).
How to fix it?

I have configured nnmaildir to use ~/Mail directory. I have created softlinks in the ~/Mail directory to selected maildir folders in ~/Maildir (tree of maildir directories)'
e.g. ~/Mail/XX-YY -> ~/Maildir/XX/YY
'(gnus-secondary-select-methods
(quote
((nnmaildir "" (directory "~/Mail")))))
https://www.gnu.org/software/emacs/manual/html_node/gnus/Maildir.html
Virtual server settings:
directory
For each of your nnmaildir servers (it’s very unlikely that you’d need more than one), you need to create a directory and populate it with maildirs or symlinks to maildirs [...]

Related

.gitignore all except one specific file (via a full/fuller file path)

The Goal:
How to use .gitignore to exclude all folders & files except PowerShell $Profile?
The answer should help expand the current exception file list to more files in other subfolders. If possible, reduce wildcards to minimum, and use as specific as possible (full/fuller file path). Why? For instance, Book1.xlsx may exist in multiple subfolders but I want to be able to choose only the specific desired subfolders.
Thanks in advance!
Current status:
On Windows 10 (not Linux Distros):
git init initiated on top level directory C:\. [Please don't suggest to start from other subfolders. Just remain with C:\, as I will include more files to the exception list]
C:\.gitignore containing the below:
# Ignore All
/*
# Exception List [eg. PowerShell's $Profile (please use FULL/FULLER FILE PATH, if possible)]
!.gitignore
!Microsoft.PowerShell_profile.ps1
!Users/John/Documents/WindowsPowerShell/Microsoft.PowerShell_profile.ps1
!Users\John\Documents\WindowsPowerShell\Microsoft.PowerShell_profile.ps1
!C:/Users/John/Documents/WindowsPowerShell/Microsoft.PowerShell_profile.ps1
!C:\Users\John\Documents\WindowsPowerShell\Microsoft.PowerShell_profile.ps1
With the above codes, git status successfully returned only .gitignore as 1 untracked file. Microsoft.PowerShell_profile.ps1 remained missing from untrack listing.
I've tried alternative ways (wildcard, partial subfolder name with pattern, etc) but all failed to return the fuller file path PowerShell $Profile.

moving files to different folders from 1

I have 200,000 files I want to send to different folders based on key words in the file name
in English if a file name has (shtf or prepper or prepping or survival) in the name send(move) it to folder shtf
if a file has (cookbook or gluten or recipe) move to food folder
*cookbook* *GLUTEN* *RECIPE*
example
(file name)
more shtf tips.epub move to folder shtf
ifshtfbeready.epub move to folder shtf
oldworldcookbook.epub move to folder food
i'm old retired ibmer small basic sas dos commands or ????
Here is a bash command, you may be able to adapt it into dos etc. I'm posting this because others may it useful as well.
find . | grep -E "(cookbook|gluten|recipe)" | while read name; do mv $name directory; done;
Where directory is the name of the directory you want to move the file. You can replace . with whatever starting directory you want, of course.
You can use wildcard in the source filename list and use a directory as the target to move multiple files with one command.
move c:\dir1\*cookbook*.* c:\food
move c:\dir1\*gluten*.* c:\food

Ansible Remote File Copy wildcard

Lets say i have this dirs and files:
Dir1/File1 - Local on my ansible host
Dir1/SubDir1/File1
Dir2/SubDir2/ - Remote Server
Dir3/SubDir3/File1
...
How is in ansible the right way to copy the local file to all remote subdirs and to specify the remote dirs as wildcard.
Before copying it should do a backup of the existing files in their dirs.
As result i want to find File1 in all SubDirs.
Regards
To create the backup of the remote file before you replace the file , you can use the 'backup' parameter in copy module. And for using wildcards you can use the fileglob parameter.
You can refer the following links.
http://docs.ansible.com/ansible/copy_module.html
http://docs.ansible.com/ansible/playbooks_loops.html#id17

How to create temporary files `.#filename` in `/tmp`, not working directory

When files are being modified in Emacs, a temporary file is created in the working directory that looks like this: .#filename. The file is deleted when the buffer is saved.
I found a few of these types of temporary files in my Git remote repositories, and I thought it might be better to nip the bud at the source instead of configuring Git to ignore them for every project.
How can we configure Emacs to create those files in the /tmp directory instead of the working directory?
The file at issue is called a lock file -- commencing with Emacs version 24.3, it can be controlled with the following setting:
(setq create-lockfiles nil)
https://stackoverflow.com/a/12974060/2112489
These files are auto-save files. The variable auto-save-file-name-transforms controls what modifications to make to the buffer's file name to generate the auto save file name. Usually, the default in file.el will suffice to put all the auto save files in the /tmp directory. It's default value is:
(("\\`/[^/]*:\\([^/]*/\\)*\\([^/]*\\)\\'" "/tmp/\\2" t))
That /tmp comes by reading the variable temporary-file-directory. Check that value so that it points to /tmp. Then, the value constructed for auto-save-file-name-transforms (and hence for the auto save file name) will be correct.
As a more general solution, you could also make a global exclude file, which applies to all repositories locally. By default, this will be in $XDG_CONFIG_HOME/git/ignore (usually ~/.config/git/ignore). The path can be overridden using the core.excludesFile option. See the gitignore manpage for more details.
$ mkdir -p ~/.config/git
$ echo '.#*' >> ~/.config/git/ignore

Deleting subdirectories and files in a given directory

I want to delete all subdirectories and files from a directory, but not the directory itself. For examnple, if I pass "Sample" directory in a variable, and "Sample" directory contains three subdirectories and 3 files, I want to delete all that 3 directories and 3 files. In practice, the "Sample" directory can contain many subdirectories and files.
ETA: This is actually in perlfaq5: How do I delete a directory tree?
Use File::Path, core module.
perl -MFile::Path=remove_tree -we
'remove_tree("Sample",{keep_root=>1}) or die $!'
The keep_root option will cause remove_tree to keep the top directory:
keep_root => $bool
When set to a true value, will cause all files and subdirectories to
be removed, except the initially specified directories. This comes in
handy when cleaning out an application's scratch directory.