Skip to content

Instantly share code, notes, and snippets.

@agentcobra
Created March 30, 2020 15:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save agentcobra/e21613cfdc975a0b25ff43fe3e6373f4 to your computer and use it in GitHub Desktop.
Save agentcobra/e21613cfdc975a0b25ff43fe3e6373f4 to your computer and use it in GitHub Desktop.
Permet de déplacer des fichiers en créant des sous-dossiers contenant n fichiers
n=100;
cd $1
p=1;
i=0;
IFS=$'\n';
for file in $(ls)
do
let i++;
currentDir="./page_"$p
echo $currentDir;
mkdir -p $currentDir
echo "$file";
mv "$file" $currentDir
if [ $(($i%$n)) -eq 0 ]
then
let p++;
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment