Add-Type -Assembly "System.IO.Compression.FileSystem" [System.IO.Compression.ZipFile]::ExtractToDirectory(($pwd).path + "archive.zip", ($pwd).path)
Category: File System
Connecting to FTP using TLS without a certificate check
lftp -e 'debug 10;set ftp:passive-mode on; set ssl:verify-certificate no; set ssl-allow true; ls; bye;' -u user,passwd ftp://example.com/
Restore correct ownership on a domain folder and all its contents
INFO=($(MYSQL_PWD=`cat /etc/psa/.psa.shadow` mysql -uadmin psa -sN -e'SELECT h.www_root,s.login FROM domains d, hosting h, sys_users s WHERE s.id=h.sys_user_id AND h.dom_id=d.id AND d.name="example.com"')); chown -R ${INFO[1]}:psacln ${INFO[0]}; chown ${INFO[1]}:psaserv ${INFO[0]}
Starting from Plesk 17.8 it can be done easier
plesk repair fs example.com
Find files the user cannot read
sudo -u the_user bash -s "find /path/to/directory ! -readable"
Extract an .msi file
msiexec /a C:\path\to\the.msi TARGETDIR=C:\path\to\extraction\dir\ /qn
Show permissions for a file and all parent folders
function namei { If ( $args[0] -eq $null ) { $path = ($pwd).Path } Else { $path = $args[0] } If ( -not (Test-Path -Path $path) ) { echo "Path does not exist" return } While ( $path -ne "" ) { $acl = Get-ACL -Path $path echo $path "`r`n" ( $acl | Select -Property Owner,Group | FL | Out-String ).Trim() $acl | Select -Expand Access | Select -Property FileSystemRights,AccessControlType,IdentityReference,IsInherited | FT $path = $path | Split-Path } }
namei C:\Windows
Show permissions for a file and all parent folders
namei -om /etc/nginx/nginx.conf
Move and overwrite all files in destination, including hidden
rsync is required
--dry-run
option might be used to check what actions will be performed by rsync, without actually running them
rsync -av --remove-source-files /src/ /dest/