command line – How to sort files into directories and subdirectories by name?

I’m new to ubuntu and also to the programming world, and I don’t really know how to do this!

I have a folder with lots of files named as follows:

000_S_001_mpc_asd.json
000_S_001_mpc_asd.nii
000_S_001_mpc_asd_aa.nii
011_S_001_mpc_asd.json
011_S_001_mpc_asd.nii
011_S_001_mpc_asd_aa.nii
000_S_002_mpc_asd.json
000_S_002_mpc_asd.nii
000_S_002_mpc_asd_aa.nii
000_S_001_dtd_rty.bval
000_S_001_dtd_rty.bvec
000_S_001_dtd_rty.nii
000_S_001_dtd_rty.json
011_S_001_dtd_rty.bval
011_S_001_dtd_rty.bvec
011_S_001_dtd_rty.nii
011_S_001_dtd_rty.json
000_S_002_dtd_rty.bval
000_S_002_dtd_rty.bvec
000_S_002_dtd_rty.nii
000_S_002_dtd_rty.json
011_S_001_flf_lkj.json
011_S_001_flf_lkj.nii
011_S_001_flf_lkj _aa.nii
000_S_001_flf_lkj.json
000_S_001_flf_lkj.nii
000_S_001_flf_lkj_aa.nii
000_S_002_flf_lkj.nii
000_S_002_flf_lkj_aa.nii

Let’s say xxx_S_xxx is the principal name, and the rest of the file’s name gives secondary information (let’s call it secondary name).

I would like to find a specific name into the secondary name and make a folder with this name (for example mpc, dtd or flf), then make subfolders named as the principal name of each file and into those folders put the respective files.
Probably an image will explain better what I’m trying to say.

So for example, the output for the names I gave you above would be look like this:

Desired output:

Is this possible to do from the terminal?
I would appreciate your help.

My OS is Ubuntu 20.04 LTS

seo – Do subdirectories of a domain have their own kind of internal ranking to the point that it matters in which one we publish new content?

Let’s say I have a blog on example.com/blog/ and now I decide to create another blog inside example.com/product/blog/

If example.com/blog/ has been out there for 7 years and its content has been indexed for much longer, would it be better for SEO to keep posting blog posts on it instead of moving some away to some other subdirectory?

Do subdirectories of a domain have their own kind of “internal ranking” to the point that it matters which subdirectory we use to publish our content?

subdirectory – Multilingual web-page using subdirectories within a single domain

I want my webpage to be in multiple languages on the same domain, for example:

domain.com/en

domain.com/ru

I can manually translate index.html into the languages I need, this is not a problem.
I tried to google the solution for hours, in the end I came across only theory. Like what is better: sub-domain or sub-directory. I haven’t found any guides on how to implement this. I understand that domain.com/your_language is just folder containing your web-page stuff in a specific language, but I’m pretty sure there is more to set up or adjust for this.

My hosting provider is using apache on a linux machine. Personally, I only have access to the public_html folder.

enter image description here

Personally, I don’t care about search engine rankings, because this is my diploma project and it may not be indexed by Google in the end.

Would really appreciate it if someone guided me to the right place to get started.

Thank you!

windows – Extracting multiple password-protected archives located in multiple sub-directories

There is a folder that contains many folders and subfolders, and each of these contains any number of password-protected 7zip archives. The password is the same for all of them. These are single-layer archives (no archives within archives).

I am trying to extract all of them in a single command in such a way that:

  1. Every file will be extracted to the directory in which its original archive was located without a subfolder being created for it,
  2. Each original archive file will be deleted,
  3. and the password will be input automatically by the command.

I already know this needs to be some kind of script since the 7zip context menu doesn’t allow to do this AFAIK. However, I am not well-versed in command-line usage and would really appreciate if someone could provide a script I could copy-paste…

I already looked through a bunch of answers, including the following that describe a similar situation minus the password aspect:

seo – How to get duplicate geo-targetted sub-directories indexed when Google is ignoring the canonicals?

I have a main website example.com which is mainly used for targeting one country. We recently started creating sub-directories for targeting other countries i.e, example.com/us/, example.com/ph/ etc., We have replicated the same example.com and created sub-directories i.e, content and design are same. I have put canonical URL for sub-directories as example.com, as that is the primary domain.

Now, after optimizing sub directory pages based on country wise, I have changed certain sub directories canonical URL as example.com/us/ – My sub-directories are not getting crawled or indexed. In search console, it shows me the error – “Duplicate, submitted URL not selected as canonical”
I have changed canonical URLs but its been a month, the pages are not still not shown in the search results. What should I do to get my pages crawled?

seo – How should i get my subdirectories indexed?

I have a main website xyz.com which is mainly used for targeting one country. We recently started creating sub directories for targeting other countries i.e, xyz.com/us/, xyz.com/ph/ etc., We have replicated the same xyz.com and created subdirectories i.e, content and design are same. I have put canonical url for subdirectories as xyz.com as that is the primary domain.
Now, after optimizing sub directory pages based on country wise, i have changed certain sub directories canonical url as xyz.com/us/ – My subdirectories are not getting crawled or indexed. In search console, it shows me the error – “Duplicate, submitted URL not selected as canonical”
I have changed canonical urls but its been a month, the pages are not still not shown on SERP. Kindly suggest me what should i do to get my pages crawled.

How to rsync only specific directories and all their subdirectories and files?

Let’s say I have something like

/path/to/dir1/[...]
/and/path/to/dir2/[...]

on

/

And I’d only like to rsync those two and everything they contain to

/backup/

So after rsync I have a copy of them in

/backup/path/to/dir1/[...]
/backup/and/path/to/dir2/[...]

I’ve played around with –include-from=/etc/rsync-backup.conf, –files-from==/etc/rsync-backup.conf iterated through all “include file” layouts, I could imagine, including all those ‘‘ and ‘**’ variants, with ‘+’ in front and without, but I failed miserably.

So: What needs to be in /etc/rsync-backup.conf and how does rsync have to be called to only backup /path/to/dir1/[…] and /and/path/to/dir2/[…]?

system – Searches for files in all subdirectories of a directory

I need to find a file in all subdirectories of the Netflix folder. The file’s name is in this code section of AndroidManifest.xml:

<activity android:name=".ui.launch.UIWebViewActivity" enabled="@bool/phone" theme="@style/Theme.Netflix.Default.FullScreen">                                                                  
 <intent-filter>                                                   
  <action android:name="android.intent.action.MAIN"/>                                                                         
  <category android:name="android.intent.category.LAUNCHER"/>                                                             
 </intent-filter>                                          
</activity>

As you can see in the first line of this section of code, it references the file .ui.launch.UIWebViewActivity I need to find this file. I already ran find -name .ui.launch.UIWebViewActivity but this file is not in the root folder, it can be in any subdirectory right?

Edit:

I’m following a tutorial, learning to put a payload in an apk manually, but it comes to a stage where it searches the file AndroidManifest.xml for a reference to the code:
<action android: name = "android.intent.action.MAIN" /> <category android: name = "android.intent.category.LAUNCHER" />
And then we have to look for the <activity> tag and then we search for this tag that contains the code snippet above, and then we will find the file that we need to modify, in my case this is .ui.launch.UIWebViewActivity but in the tutorial is this com.dev47apps.droidcam.DroidCam, but when I modify it I cannot find the file, tutorial I’m following: https://medium.com/@nimishjain511/creating-a-backdoor-in-apks-a4aae59f4e06

How Can I Merge Multiple Directories into One keeping the subdirectories

I have multiple directories and each one contains multiple subdirectories. How do I send all subdirectories to the same directory?

seo – Upgrading my website to be multilanguage with subdirectories, Without losing my good google ranking

I have a Belgium regular HTML website where you can rent my jazzband for events, For years my website was in dutch only, but I would like to also have the french speaking belgium citizens as new costumers. (Belgium has north dutch speakers and south french speakers) My ranking on google is really good, so I do not want to lose my position when adding the french language on it.(note: I always will have and want mostly dutch visitors)

My website is now still www.myexamplesite.be (all my extra pages are in my rootfolder)

For my upgrade I did copy all my pages and translated them, and used the *hreflang=”nl-BE” and “fr-BE”*stuff on all my pages linking both languages on each page. All my pages are organised in a subdirectory, all dutch pages in /nl/.. and french pages in /fr/.. On each page there is a menubutton to swith language (it links to the html in the right directory).

for the moment I have this:

root/index.html  --> www.myexamplesite.be (a dutch written homepage with all my links leading to the /nl directory.
root/nl/index.html --> www.myexamplesite.be/nl/index.html this is a copy of my 'root/index.html'
root/fr/index.html --> www.myexamplesite.be/fr/index.html this is the french translated homepage

Is this the best option? (thinking about my ranking), will google automatically lead the french speakers to my /fr/index? and the dutch to nl/index or root/index ?
Or should consider ‘language redirect with htaccess’ on my root/index.html?
Or…other options?