My friend has been dangerously uncareful with their external hard drive usage and now possesses a drive with probably thousands of files in a single folder.
They have asked my help in sorting the bloody thing (being even less adept at computers than I am). I was wondering if there was software that could sort files into folders based on given characteristics? Even a program capable of performing this based on just one or two parts of the file name would be immensely helpful. A lot of the discussion I have searched thus far have consisted of writing a Python code or script of sorts and I would prefer to explore even a limited program before trying to venture into the unknown.
Any file manager could already do that, you would have to create the folders yourself though.
Sort by file type, by size, you will already be able to kinda sort manually and then you could select by chunks and move to folder (like images, music, videos, PDF or whatever the type is), size could help to sort within folders then too (movies, short clips), and the integrated search of the file manager within the folder could help to find by portion of the file name.
It does what you would like, except the automatic creation of folders but that would require a program to understand your goals.
The downside with using a graphical file manager is most of them can get slow when managing a lot of files in a single folder – moreover in the thousands.
Also, some file managers have more detailed search features than others. From a quick search, something like krusader may suit you.
I have a script that moves the correct server log file into a directory identical to the server name.
It looks for a dash (-) in any file name and then creates a bunch of directories and then moves all the files containing the server name into the server directory.
Disadvantage:Every file has to have a-in it, but you could use a space too I guess.
#!/bin/bash
echo About to make changes in this directory:
readlink -f .
read -n1 -s -r -p $'Press space to check file errors here...\n' szInput
echo Dual spaces files:
ls *\ \ *
read -n1 -s -r -p $'Press space to simulate directory creation here...\n' szInput
if [ "$szInput" = '' ]; then
# szInput is empty at IFS whitespace: space, tab, LF or enter
echo The following directories will be created:
find . -maxdepth 1 -type f | cut --delimiter='-' --fields=1 | sort --unique |
while read server ; do
echo $(sed 's/ /\\ /g' <<< "$server")
done
read -n1 -s -r -p $'Press space to create directories...\n' szInput
if [ "$szInput" = '' ]; then
find . -maxdepth 1 -type f | cut --delimiter='-' --fields=1 | sort --unique |
while read server ; do
echo $(sed 's/ /\\ /g' <<< "$server") >> /tmp/MakeDirs.sh
#mkdir $(sed 's/ /\\ /g' <<< "$server")
done
# Set no-globbing to create script to chain to
set -o noglob
echo Moving files
# overwrite existing chain file
echo "#!/bin/bash" > /tmp/move-files.sh
clear
echo Generating files...
# Find everything except hidden directories (! path .)
find . -maxdepth 1 ! -path . -type d |
while read server ; do
# echo to console and to file
echo mv $(sed 's/ /\\ /g' <<< "$server")\\\ -?* $(sed 's/ /\\ /g' <<< "$server")
echo mv $(sed 's/ /\\ /g' <<< "$server")\\\ -?* $(sed 's/ /\\ /g' <<< "$server") >> /tmp/move-files.sh
done
chmod a+x /tmp/move-files.sh
read -n1 -s -r -p $'Press [Ctrl][C] to exit before moving files...\n' szInput
/tmp/move-files.sh
else
echo -e $FRED Directories NOT created
fi
else
echo $FYEL Exited by user; wrong directory???
fi