Scripting Directory and SubDirectory Creation Based on User Input

Hello just a noob hobbyist here so this hopefully isn’t too simple of a question.

I am trying to write a script that will let me generate the entire file structure for my media using only user inputs. I have everything working execept at line 20 where the ‘mkdir Season{1..$ user_input4} lives. I would like it to take the user input_4 and make 1 + that many directories but I feel I may be looking at this from the wrong perspective as it instead makes a subdirectory named Season{1..(prints the user input)}.

#!/bin/bash file_created="Directory Created" directory_number=0 echo "How many directories should be created?" read user_input while [ $  directory_number -ne $  user_input ] do      echo "Enter Directory Name"     read user_input2          mkdir $  user_input2     directory_number=$  ((directory_number + 1)) echo "Do you want to create Seasons? Y/N"     read user_input3     if [ $  user_input3 == "Y" ]     then         echo "Enter number of seasons"             read user_input4         cd $  user_input2/         mkdir Season{1..$  user_input4}         cd ..     else     :     fi done 

If anyone has any ideas they would be greatly appreciated. Thanks!

Design Configuration Not Saving showing 404 page on sub-directory


  • Magento 2.2.4 PHP 7 Sub-directory setup

Steps to reproduce

  1. Setup sub-directory magento 2 mine site/buy/
  2. Install a supported theme for Magento 2. I have install novetty theme
  3. Update theme using ssh access and putty
  4. Trying to change the theme from Design Configuration section
  5. Showing 404 page from root site.

Details I have install magento 2.2.4 on my site sub-directory. Every thing was properly installed and worked. But when I install a new theme, its was setup properly. I try to change the from the default one to new theme its showing 404 page. Example are given. Could you please help me fix it.

enter image description here

enter image description here

Why is rsync creating a new subdirectory?

Under a directory c:\topDir, I have two folders subFolder1 and subFolder2. Each has about 300 GB of files, some are the same and some are not, and some subdirectories are present in one folder and not in the other. It’s not possible to delete subFolder2 before copying, unfortunately.

I would like to recursively copy all the contents of subfolder1 into subfolder2. From c:\topDir, I ran the following command,

rsync -ra --info=progress2 subFolder1 subFolder2 

but it created a new subdirectory under subfolder2 before copying everything into it, c:\topDir\subfolder2\subfolder1

What do I need to do to copy subfolder1’s contents to subfolder2 without putting them into a new subdirectory? I am using rsync on cygwin, if that matters.

Nginx: Sub-directory access to containerized Taiga using Nginx

I have installed Taiga in a container using this, and the front-end is listening on port 80 of the container, the back-end is listening on port 8001. Because I have nginx web server on port 80 of my host, I bind the container port 80 to port 8050 of the host.

What I want now, is to access to Taiga using subdirectory:

I tried to add in Nginx proxy-pass like this:

location /taiga { proxy_pass; proxy_http_version 1.1; proxy_set_header Upgrade $  http_upgrade; proxy_set_header Connection "upgrade"; proxy_set_header Host $  http_host; proxy_set_header X-Forwarded-For $  remote_addr;     try_files $  uri $  uri/ /index.html; } 

But when I type, I am not redirected to, but to default Nginx page which listens on port 80 of my host.

What could be wrong ?

Thank you.

Drupal in subdirectory: can’t install modules

I have Drupal 8 installed in a subfolder (, and I have my root .htaccess configured to mask the subfolder (i.e. the URLs resolve to; /drupal does not appear in the URLs).

Everything works great except when I try to install new modules I get a 403 error. I see in the URL for authorize.php that /drupal now appears in the URL. Where I would expect, I instead see I imagine this is the reason for the 403?

What additional modifications do I have to make to /drupal/.htaccess in order to get access to the /core files required to install new modules?

Here’s what’s in my document root .htaccess:

RewriteEngine On RewriteCond %{REQUEST_URI} !drupal/ RewriteRule (.*) /drupal/$  1 [L] 

And the only modification to /drupal/.htaccess is to uncomment the subdirectory per the instructions in the file:

# Modify the RewriteBase if you are using Drupal in a subdirectory or in a # VirtualDocumentRoot and the rewrite rules are not working properly. # For example if your site is at uncomment and # modify the following line: RewriteBase /drupal 

Apache – Adding Redirect to sub-directory V/S changing DocumentRoot

I want to understand security implications of changing DocumentRoot in Apache to an installed website versus adding a RewriteRule.

The reason I ask this, I have a website that is installed under /var/www/html/website/. I initially changed the DocumentRoot to /var/www/html/website in the 000-default-le-ssl.conf file. This however, exposed certain elements during an NMAP scan. Specifically JS and CSS files. Examples:

https://ipaddress/nextcloud/core/js/contactsmenu.js?v=6e38f86c-7 https://IPaddress/nextcloud/core/css/guest.css?v=6e38f86c-7

and few more.

I considered this insecure behavior and hence added the following as part of the 000-default-le-ssl.conf configuration file.

I changed DocumentRoot to /var/www/html and added:

RewriteEngine on RewriteCond %{REQUEST_URI} ^/$   RewriteRule (.*) /nextcloud/ [R=301] 

Hence my question, is there any security benifit of changing DocumentRoot to default and adding a redirect or is the end result the same?

Also, I know this is product specific (nextcloud), but should such files be visible?

Different redirects for a subdirectory and second level subdirectories in nginx

I am not really experienced in nginx configuration but have a very specific problem. Our website has a blog on a subdomain – and we want to redirect to this subdomain. I already did this configuration and it works:

location ^~ /blog {                   rewrite ^/blog(.*)$  1 permanent;                 } 

Now, the problem is that although points to the home page of the blog, all the post links are like this : 

So they are under a subdirectory /blog. Now we have some old links posted on linkedin, etc. which won’t work since anything like will redirect to and not

How can I do a second configuration where I can add a /blog to the redirect ( )if there is a subdirectory like

SharePoint claims with single sign on redirects when accessing _trust subdirectory

I have developed a cutom STS/Identity provider/SSO (Single sign on) website in MVC3 which acts as a claims provider. This site signs on a user to a sharepoint site using WSFederation.

It correctly signs on a user to “http://MYSP/_trust/” and then it redirects the user based on the wctx e.g. “http://MySP/library/1” etc. However the issuer I have is if SSO logs the user into Sharepoint, they leave without signing out of SharePoint, go back to the SSO which then tries to log them back into Sharepoint. This causes SharePoint to redirect the user back to the SSO (it ignores the wctx).

I think its related to the fact that if I browse “http://MYSP/_trust/” it automatically redirects me back to my SSO site even if I am logged into SharePoint. Does anyone know why it does that?

Also why does it ignore the wctx If the user is already logged in?

Thanks for any help you can provide me!

Move file uploads in webform into subdirectory using hook_webform_submission_presave

I’m using the webform_multiple_file module to let users upload files in a webform. There is a second form component in that form. It’s a number. I want to change the upload directory, which is defined on webform admin and is ‘webform/uploads’ in my case. I want the uploaded files to be stored in subfolders named by the number in the second form field. So the upload directory should be like ‘webform/uloads/102’.

I first tried to accomplish it with hook_webform_submission_presave, but I only can change the file id.

Then I found hook_file_presave, which seems to be the perfect function to solve my problem, but now I’m stuck with the question, how to get the value from my form field into the presave function? The only parameter is $ file.

Can someone help me on this? Submission- or file-presave? Is it possible to change the file- and upload-directory in hook_webform_submission_presave?


I was able to get the form value with $ GLOBALS in hook_file_presave.

$  order_number = $  GLOBALS['_POST']['submitted']['upload_formular']['upload_wrapper']['bestellnummer']; 

Some string-functions on $ file->uri do get the split point and first and second part of uri. Append first part with the value of ‘bestellnummer’ as the subdirectory. Next I create the subdirectory with

file_prepare_directory($  newdir, FILE_CREATE_DIRECTORY); 

Then I change $ file->uri and $ file->destination to new URI, and dpm($ file) shows, that it’s changed. The new directory is created, but the file is still in the original folder after submitting the form.

It seems I’m missing something here…