Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
I download a lot of different stuff all the time. Often times I don't actually get around to cleaning it up. Thus, I decided I needed to build a script to further encourage my bad habits.
Here I've built a script for both Windows and Linux. It's designed to take all the files in the current directory and move them into their own folders based on their extensions. Why is this useful?
It's fucking useful when you're not having to swim through fucking mountains of content.
Anyways without any further ado here are the scripts.
Linux
#!/bin/bash
for i in *.*; do
filename=$(basename -- "$i")
extension="${filename##*.}"
extension="$extension"files
mkdir "$extension"
mv "$i" "$extension"
done
Windows
@echo off
for %%i in (*.*) do (
if not exist %%~xifile md %%~xifile
)
for %%i in (*.*) do (
if "%%i" NEQ "movingFiles.bat" move "%%i" "%%~xifile"
)
rant
it's useful to be somewhat organized
files organization