
Quero usar a linha de comando para acessar os arquivos no iPhone em vez de usar o windows Ctrl+ C, Ctrl+ Vpara copiar todos os arquivos para o meu PC.
Dei uma olhada para ver se conseguia mapear "Este PC" ou qualquer uma das outras linhas como uma unidade de rede, mas não consegui descobrir como.
Conforme abaixo, pretendo copiar as pastas do iPhone usando a linha de comando, provavelmente o prompt de comando estilo DOS.
Responder1
Se você quiser evitar software de terceiros,PowerShellpode usar o shell.application
objeto com para acessar pastas virtuais e dispositivos MTP. Aqui está um script de cópia simples:
$pcDestinationPath = 'C:\Wherever\You\Want'
$phoneRelativePath = 'Internal Storage\DCIM'
$shell = New-Object -com shell.application
$PhoneFolder = ($shell.NameSpace("shell:MyComputerFolder").Items() | where Type -match 'Mobile Phone|Portable Device').GetFolder
### To access a subfolder, you have to "walk" its path
$SourceFolder = $phoneRelativePath.Split('\') |
ForEach-Object -Begin {
$comFolder = $PhoneFolder
} -Process {
Try
{
$comFolder = ($comFolder.Items() | where {$_.IsFolder} | where Name -eq $_).GetFolder
}
Catch
{
Write-Error 'Failed to parse $DeviceFolderPath'
}
} -End {
$comFolder
}
### Get comFolder object for $pcDestinationPath
If ( ! (Test-Path $pcDestinationPath) )
{
mkdir $pcDestinationPath -Force | out-null
}
$pcDestinationFolder = $shell.NameSpace($pcDestinationPath)
### Option 1: Copy $SourceFolder as a single item
$pcDestinationFolder.CopyHere($SourceFolder.Self)
### Option 2: Copy *the contents of* $SourceFolder as a collection of items
$pcDestinationFolder.CopyHere($SourceFolder.Items())
### Option 3: Copy selected items from $SourceFolder individually
$SourceFolder.Items() | where {<Test-Expression(s)>} |
ForEach-Object {
$pcDestinationFolder.CopyHere($_)
}
### FolderItem properties available for testing:
### - IsFolder
### - IsLink
### - ModifyDate
### - Name
### - Parent
### - Path
### - Size
### - Type
Cada diretório tem umPastaobjeto e umItem de pastaobjeto associado a ele. Eles podem fazer referência um ao outro com as propriedades .Self
e GetFolder
:
|--------> Folder.Self ------->|
Folder FolderItem
|<--- FolderItem.GetFolder <---|
Referências: