Added 10 more gists.

This commit is contained in:
Miguel Astor
2023-06-19 09:38:01 -04:00
parent 8af706e97d
commit 1400a87eab
25 changed files with 1133 additions and 0 deletions

1
flatten.sh/README.md Normal file
View File

@@ -0,0 +1 @@
A Bash script that recursively searches for files in subdirectories of PWD and moves them to PWD.

24
flatten.sh/flatten.sh Normal file
View File

@@ -0,0 +1,24 @@
#! /bin/bash
BASE_DIR=`pwd`
for dir in `ls -1 $BASE_DIR`
do
if [[ -d $dir ]]
then
cd $dir
for i in `seq 1 100`
do
FILE=`ls -1`
if [[ -d "$FILE" ]]
then
cd $FILE
else
break
fi
done
mv "$FILE" $BASE_DIR
cd $BASE_DIR
rm -rf $dir
fi
done