Finding empty directories

It depends a little on what you want to do with the empty directories. I use the command below when I wish to delete all empty directories within a tree, say test directory. find test -depth -empty -delete One thing to notice about the command above is that it will also remove empty files, so … Read more

Changing the default folder in Emacs

You didn’t say so, but it sounds like you’re starting Emacs from a Windows shortcut. The directory that you see with c-x c-f is the cwd, in Emacs terms, the default-directory (a variable). When you start Emacs using an MS Windows shortcut, the default-directory is initially the folder (directory) specified in the “Start In” field … Read more

Creating a new directory in C

Look at stat for checking if the directory exists, And mkdir, to create a directory. #include <sys/types.h> #include <sys/stat.h> #include <unistd.h> struct stat st = {0}; if (stat(“/some/directory”, &st) == -1) { mkdir(“/some/directory”, 0700); } You can see the manual of these functions with the man 2 stat and man 2 mkdir commands.

how to prevent “directory already exists error” in a makefile when using mkdir

Looking at the official make documentation, here is a good way to do it: OBJDIR := objdir OBJS := $(addprefix $(OBJDIR)/,foo.o bar.o baz.o) $(OBJDIR)/%.o : %.c $(COMPILE.c) $(OUTPUT_OPTION) $< all: $(OBJS) $(OBJS): | $(OBJDIR) $(OBJDIR): mkdir -p $(OBJDIR) You should see here the usage of the | pipe operator, defining an order only prerequisite. Meaning … Read more

PathLib recursively remove directory?

As you already know, the only two Path methods for removing files/directories are .unlink() and .rmdir() and neither does what you want. Pathlib is a module that provides object oriented paths across different OS’s, it isn’t meant to have lots of diverse methods. The aim of this library is to provide a simple hierarchy of … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)