Using a dynamic drive letter alias for apache - apache

I'm using XAMPP on my USB flash drive - which makes it easy for me to take my dev. environment with me from one PC to another.
However, I want to be able to serve files for my projects directly from my /Projects folder - which is in the root of the drive - instead of having to copy this folder into /htdocs.
I've read on the web that I can easily do this by adding an alias to 'httpd.conf' - but I would then need to hard-code the drive letter - which can be different for every PC I plug my USB into.
Is there any way to add a dynamic driver letter to my alias ?
Or - can I maybe use a relative path somehow ?
Or - am I going about it wrong and there's a better way to do it ?
Thanks in adv!

First of all, I think you already know that xampp lite supports relative addressing to run it in portable mod.
But when it comes to location of htdocs folder, I didnt experienced something like that. But I can offer some alternates (without moving the htdocs folder) which can be useful.
This simple .bat file (located in the same root of xampp folder)
#ECHO OFF
:START
Start xampp\htdocs
Can open your "htdocs" folder without depending to drive letter.
If you try to make something more complicated, here it comes the drive letter variable in .bat
#ECHO OFF
PUSHD \
SET AMOVIBLE=%CD%
POPD
ECHO %AMOVIBLE%
PAUSE
This example will show you the drive letter that the bat file executed from. Just move the %AMOVIBLE% variable wherever you want in your code.
And if variables from an external file is needed
Define variable
(SET /P var=)<sometextfile.txt
MKDIR folder\%var%\folder\
This can help.
So, if the movement of htdocs folder is not obligated, I think these will help. If not, sorry out of my range :)
Regards

Related

change the location of the .nextflow folder?

when I run nextflow, I get a .nextflow folder, but I can't find a way to change its location (i.e. it is't -work-dir). How can I change the location of the .nextflow folder?
I have looked at launchDir but it seems that is a read-only implicit variable and cannot be overwritten in the CLI, also, the --launchDir option is only valid for the k8s scope (see original chat in gitter)
I'm using Nextflow 20.10.0 build 5430.
Keeping things neat and tidy is admirable. From this comment, it looks like the only way (without doing crazy things...) is to change to the directory you want your .nextflow cache directory to live and point all other options (i.e. -work-dir, -log etc) away to a separate directory:
If you want .nextflow in dir A and the pipeline work dir in B:
cd A
nextflow run -w B
The .nextflow has to be in the launching
directory to properly maintain the history of the executions.

Change Folder Permissions with Terminal

I'm trying to change the permissions of a folder. I want to make a folder, and everything in it restricted to me only; other users can't view it.
The folder, though, contains hundreds of other files in it. Is there a way in Terminal to change the permissions a folder and everything in it? I know this can be accomplished with "Get info" but there's simply too much files inside that folder to manually do that with every file.
I'm running on OS X Mavericks 10.9.5.
Help would be greatly appreciated!
of course there is a way.
You should set the ownership to your user and remove at least the executable flag for the folder. No one will be able to enter the folder via the cd command or the finder, etc.
First change directory to the location where the desired folder is located (its parent folder).
cd path/to/parent/folder
then remove the executable flag for its group (g) and all others (o)
chmod go-x folder
If you also want to make its contents invisible for actions like
ls folder/
then you have to remove the readable flag also.
chmod go-r folder
#micebrain: And there is no need for changing the permissions recursively for all folders and files inside the folder, because you can control the access of opening a folder.
BTW the executable bit (x) - if set - makes files executable and folders openable...

Move folder structure from one computer to another computer when these computers aren't networked?

I have two computers that aren't networked. I need to replicate the folder structure of one drive that exists on one computer and put it on the other computer. Both Windows 7 machines. I don't need the files, just folders/directories. The drive letters are the same on both computers (Y). The computers are miles apart physically, but I do have access to the computer I am trying to get the folder structure of via LogMeIn.
I am thinking I need to save the folder structure to a file using some process. Move that file to my computer (via email or LogMeIn File Manager) and run some process to put in on my computer.
Is there a better solution? If not, is there code out there to do this via VBA, Cmd window, .bat script, VB.NET, or VBS? I know I can write it in VBA, but I'd rather not recreate the wheel if I don't have to.
I don't have a 'process'/program that does this. LogMeIn File Manager doesn't do this either (I asked). There are lots of paths on this drive that I need so creating them by hand would take a long time. I searched and found a lot of solutions that work with computers that are networked, but these computers are not networked, hence why I think I need to save it to a file. Again, I don't want all the files on the drive (its huge and most of the files are unnecessary), just folders.
thanks.
Create a directory listing of the source computer and redirect the output to a text file:
dir /ad /b /s >> dirlist.txt
The switches to dir are (more info at MS TechNet):
/ad List only files with attribute of directory
/b Bare format (no heading information or summary)
/s Displays files in specified directory and all subdirectories
Transfer dirlist.txt from the source computer to the destination computer.
On the destination computer, use a for /F with that text file from the command prompt to create the directory structure:
for /F "delims=" %i in (dirlist.txt) do md "%i"
The switches to for are documented at MS TechNet
You have many options:
Windows command xcopy source destination /T /E. The /T option creates the directory structure, and the /E option includes empty directories.
Bundle the empty directory structure into an installer (perhaps as a zip file).
If the structure isn't relatively small and not likely to change, you could just put a bunch of md commands into a batch file.
Combination - xcopy the structure locally, zip it, transfer it, unzip it.

How to run Apache benchmark load-test in Windows?

what's the procedure I should follow to run a simple test on a domain www.example.com? I'm on Windows environment and have installed WAMP server 2.1.
I actually know which command I should use (Ex. ab -n 1 http://www.example.com/) but don't know where I should type it.
I don't know the path WampServer is installed to, so I'll just show you how I do it under WampDeveloper (which is what I use).
Run cmd.exe.
Inside...
C:
cd \WampDeveloper\Components\Apache\bin
ab -n 1 http://www.example.com/
To answer your question, you type it in the command line changed to the bin folder of your Apache folder since this is where ab.exe exists. If this folder location is in the system path, you can also just type it in anywhere (without changing paths in cmd.exe).
This 1st line changes the drive letter. Then second the path (aka working directory). The third runs ab.exe.
I do agree, PATH ENVIRONMENT setup manually
C:/YOUR_INSTALLATION_APACHE2/bin
Path to environment on control panel system settings.

xcopy with unc path adds virtual network drives

When i copy files to a some network path with xcopy command I get new virtual drives on my pc .
The problem is that i do that within a batch script that runs in scheduler so i get there a lot of drives to same location.
How I can copy files to a network with out getting a new drives on the pc or just remove them
?
Thanks.
Wait a minute. You're using pushd. pushd, as the documentation states:
If Command Extensions are enabled the
PUSHD command accepts network paths in
addition to the normal drive letter
and path. If a network path is
specified, PUSHD will create a
temporary drive letter that points to
that specified network resource and
then change the current drive and
directory, using the newly defined
drive letter. Temporary drive letters
are allocated from Z: on down, using
the first unused drive letter found.
While that's perfectly fine to use, you should never call pushd without an appropriate popd afterwards.
So instead of just
pushd \\somepath\etc
xcopy "%mycopyposition%*.exe"
you add another line
popd
which will de-allocate the temporary drive letter again.
It sounds like the command you are using to call xcopy. Can we see that ?
the net command is your fiend (as good a fiend you can get on Windows). To remove a network drive you might want to look at:
net use /?