I did this little script to automatically create folders for a python course I was doing. It asks for the number of folders and for the extension of the files in the folder then it creates this num of folders each one with a file of this tipe in. I have created an alias for it to be able to call it in the terminal from any directory.
To do this I have followed the following steps:
-
Download the file.
-
Save it in a folder that you are not going to delete and that is where the alias will look for it.
-
Copy the path where the file is located.
-
Open a terminal in the same directory and run:
chmod u+x AutoDir.sh
-
Also install:
sudo apt-get install tree
-
Now run:
nano ~/.bashrc
-
And at the end of the file add the following line with CTRL + SHIFT + V:
alias AutoDir='cp /home/marcos/Documents/AutoDir.sh . && ./AutoDir.sh && rm AutoDir.sh'
-
Change your path to the path where the original file is located.
-
Press CTRL + X.
-
Press Y and enter to save the file.
-
And now run:
source ~/.bashrc
And that's it, you already have it installed. When you want to run it, simply open a terminal in the directory you want to create the folders and run:
AutoDir