; мешали перед bash -c
*/5 * * * * /usr/bin/flock -n /tmp/fcj.lockfile; bash -c 'source /mnt/c/Users/MissAnastasiia/Script/script.sh; prepare "$Prepare"'
function prepare(){
find "$Downloads" -not -iname *!ut -depth | sort -r | while read file; do RENAME=$(dirname "$file")/$(echo $(basename "$file") | sed -f "$Template" );
if [[ "$file" != "$RENAME" ]];
then
mv -fv "$file" "$RENAME" && sleep 0.1s || exit 0
fi
done
if [[ "$file" == "$RENAME" ]];
then
find_file
fi
}
function find_file(){
x="$IFS";IFS=$'\n';for File in $(find "$Downloads" -regex "$ExVideo" -o -regex "$ExMusic" | sort -r );
do
IFS="$x"
if [[ -n "${File[@]}" ]];
then get_names "${File[@]}"
fi
done
}
function rename(){
for value in "${@}"
do
if [[ -n "$@" ]];
then
NEWNAME=$( echo "${@}" | sed -f "$Template" )
mv -fv "${@}" "$NEWNAME"
fi
done
}
Folder="/mnt/d/User"
function find.file(){
x="$IFS";
IFS=$'\n';
for File in $(find "$Folder"/. -regex ".*pdf" -o -d | sort -r );
do
IFS="$x"
if [[ -n "${File[@]}" ]];
then rename "${File[@]}"
fi
done
}
function find.file(){
x="$IFS";IFS=$'\n';for File in $(find "$Folder" -not -path "$Folder" | sort -r );
do
IFS="$x"
if [[ -n "${File[@]}" ]];
then rename "${File[@]}"
fi
done
}
function rename(){
for value in "${@}"
do
RENAME=$(dirname "$@")/$(echo $(basename "$@") | sed -f "$Template.Newname" );
if [[ "$@" != "$RENAME" ]];
then
mv -fv "$@" "$RENAME"
fi
if [[ "$@" == "$RENAME" ]] && [[ -n "${File[@]}" ]];
then type.media
fi
done
}
find
. В Folder потому как заходит /mnt/d/