Powershell MTP Connections

Welcome Forums General PowerShell Q&A Powershell MTP Connections

Viewing 2 reply threads
  • Author
    Posts
    • #61776
      Participant
      Topics: 1
      Replies: 1
      Points: 0
      Rank: Member

      HI guys

      I`m having trouble copying the files from an android phone to the local pc by using the following script found on:
      http://www.pstips.net/access-file-system-against-mtp-connection.html#将我手机中的外置存储卡中的DCIM下的照片和视频按日期复制在D:\DICM目录下

      I`m not sure how to add the following to the main script or if it must be created separately:

      $des = 'D:\DICM'
      $phone = Get-ChildShellItem | where { $_.name -eq 'a820t' }
      Get-ChildShellItem -Path "$($phone.Path)\Internal Storage\DCIM" -Filter '(.jpg)|(.3gp)$' | foreach {
      #获取照片创建日期
      $datestr = $_.Parent.GetDetailsOf($_,3)
      $datestr = ([datetime]$datestr).ToString('yyyy-MM-dd')

      #新建日期文件夹
      $dir = Join-Path $des $datestr
      if( -not (Test-Path $dir) ) {
      mkdir $dir
      }

      # 复制文件
      Copy-ShellItem -Path $_ -Destination $dir
      # 或者移动文件
      # Move-ShellItem -Path $_ -Destination $dir
      }

      Can somebody just point me in the right direction as i havent seen anybody else able to copy files from an Android phone to the local Computer using Powershell.

    • #61945
      Keymaster
      Topics: 13
      Replies: 4872
      Points: 1,870
      Helping HandTeam Member
      Rank: Community Hero

      Does the Android phone appear as a drive in Windows? Or a UNC? I mean, could you do this copy using File Explorer?

    • #61996
      Participant
      Topics: 1
      Replies: 1
      Points: 0
      Rank: Member

      Hi Don

      No the Android Device does not appear as a drive in windows explorer, it appears as a Portable Media Device.

Viewing 2 reply threads
  • The topic ‘Powershell MTP Connections’ is closed to new replies.