2024-04-19 15:32:12 -03:00
|
|
|
param (
|
|
|
|
[int] [alias('p')] $port = 21,
|
|
|
|
[string] [alias('d')] $directory = '.',
|
|
|
|
[bool] [alias('w')] $write = $false
|
|
|
|
)
|
|
|
|
|
|
|
|
$venv = "\.pyftplib"
|
|
|
|
$venv = $HOME + $venv
|
2023-11-13 23:26:00 -04:00
|
|
|
# Create virtual environment
|
2024-04-19 15:32:12 -03:00
|
|
|
if (-not (Test-Path $venv)) {
|
|
|
|
write-host "Creating virtual environment at $venv"
|
|
|
|
virtualenv "$venv"
|
2023-11-13 23:26:00 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
# Activate virtual environment
|
2024-04-19 15:32:12 -03:00
|
|
|
. ($venv + "\Scripts\Activate.ps1")
|
2023-11-13 23:26:00 -04:00
|
|
|
|
|
|
|
# Install dependencies
|
|
|
|
pip install pyftpdlib
|
|
|
|
|
|
|
|
# Run FTP server
|
2024-04-19 15:32:12 -03:00
|
|
|
if ($write) {
|
|
|
|
python -m pyftpdlib -p $port -d $directory -w
|
|
|
|
} else {
|
|
|
|
python -m pyftpdlib -p $port -d $directory
|
|
|
|
}
|