bash -c 'source Users/MissAnastasiia/Script/Media.sh; prepare "$Downloads"'
#!/bin/bash
echo "version 1.0"
set -o xtrace
Dir="/mnt/d" # корневая папка & всех медиа
Downloads="$Dir/Downloads" # папка загрузки
FilmFolder="$Dir/Films" # папка фильмы
SerialsFolder="$Dir/Serials" # папка сериалы
TempMusic="$Dir/TempMusic" # папка временных lossless файлов
Template="/mnt/c/Users/MissAnastasiia/Script/rename.txt" # файл с шаблоном замен
ExVideo="$(echo '.*\.\(mkv\|m4v\|mp4\|ts\|avi\|mpg\|m2ts\)')"
ExVideoConvert="$(echo '.*\.\(m4v\|mp4\|ts\|avi\|mpg\|m2ts\)')"
ExMusic="$(echo '.*\.\(flac\|ape\|m4a\)')"
ExCUE="$(echo '.*\.\(cue\)')"
ExJPG="$(echo '.*\.\(jpg\|png\)')"
function prepare(){
for value in "${@}"
do
find "$@" -not -iname "*!qB" -o -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_stop 0
fi
Massive_file=`echo ${file[@]} ${RENAME[@]} | tr ' ' '\n' | sort | uniq -u`
done
done
if [[ "$file" == "$RENAME" ]] && [[ "$Massive_file" == "" ]];
then
find_file "${@}"
fi
}
function find_file(){
for value in "${@}"
do
x="$IFS";IFS=$'\n';for File in $(find "$@" -regex "$ExVideo" -o -regex "$ExMusic" | sort -u );
do
IFS="$x"
if [[ -n "${File[@]}" ]];
then get_names "${File[@]}"
fi
done
done
}
function rename(){
for value in "${@}"
do
if [[ -n "$@" ]];
then
NEWNAME=$( echo "${@}" | sed -f "$Template" )
mv -fv "${@}" "$NEWNAME"
fi
done
}
Start-Process -FilePath 'C:\Windows\system32\WindowsPowerShell\v1.0\powershell.exe ' -WindowStyle hidden 'wsl '
if ( $CompName -eq 'NETTOP-SQUARE2' ){
Write-Host "NETTOP-SQUARE"
}
# Map NAS Drive
Do
{
$NetDriveName = Get-CimInstance -classname Win32_NetworkConnection | select-object -expandproperty "RemoteName"
if (-not $NetDriveName) {
Write-Host "NetDriveName is null"
}
InstallNASDrive
}
Until ( $NetDriveName -contains $NASDrive )
else {
Write-Host "Another Computers"
}
else : The term 'else' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
At C:\Users\Script\startup.ps1:40 char:1
+ else {
+ ~~~~
+ CategoryInfo : ObjectNotFound: (else:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
из критического, на Powershell подняты AD управление учетными данными, вкл компов и телеграм бот через которые могу управлять различными командами