{{{1}}}
Contents |
putInDir is a bash script to move a file in a directory which has its name or, putInDirDate (see below), its date.
These two should be brought together ultimately (with options).
Call the script with the file to move as argument:
putInDir filename.dat
It will create a directory "filename" and move "filename.dat" in it.
To process all files of a given extension, use:
for f in *.zip; do putInDir "$f" ; done
#!/bin/bash
filename=$(basename $1) extension=${filename##*.} filename=${filename%.*}
mkdir $filename mv $1 $filename
Copy the file in the directory where files to be sorted are present (check extension in the script) and run. Be careful, it could be dangerous (no undo!)
#!/bin/bash #23 September 2017 for x in *.JPG; do d=$(date -r "$x" +%Y-%m-%d) mkdir -p "$d" mv -- "$x" "$d/" done