Manage files on USD device from CMD ?


cbreemer

Active member
Member
Local time
1:41 AM
Posts
81
OS
Windows 11 Pro Version 22H2 (OS Build 22621.3155)
Hi all, I wonder if there's a way to see recent files on an USB device from the command line rather than Windows Explorer ? I regularly want to grab the latest videos/photos from my Samsung Android A51 camera, but Explorer takes an awful long time to find them. I must admit there are thousands of media in the Camera folder.... I should really clean that up but that's a hell of a job. And it's probably just the Samsung interface being grindingly slow, but I somehow hope it might be better with a DIR command. Any ideas ?
 
Windows Build/Version
23H2 (OS Build 22631.3880)

My Computer

System One

  • OS
    Windows 11 Pro Version 22H2 (OS Build 22621.3155)
    Computer type
    PC/Desktop
    Manufacturer/Model
    Intel NUC12WSHi7
    CPU
    Intel Core i7-1260P
    Motherboard
    Intel NUC12WSHi7
    Memory
    64Gb
    Graphics Card(s)
    Intel Iris Xe Graphics
    Sound Card
    Intel Smart Sound for USB
    Monitor(s) Displays
    LG 34WP500 UltraWide Monitor
    Screen Resolution
    2560x1080
    Hard Drives
    Adata Legend 710 2Tb SSD
    PNY CS9000 2Tb SSD
    Keyboard
    Logitech K540 Bluetooth
    Mouse
    Logitech M310 Bluetooth
    Internet Speed
    200Mbps
    Browser
    Chrome
    Antivirus
    Avast Free Antivirus
The forfiles command is your friend here.

FORFILES /P C:\WINDOWS /S /M *.txt /D +2024-6-12

Would give me all of the files in C:\Windows and subdirectories (/S), matching the pattern *.txt, created on or after June 12, 2024.
 

My Computers

System One System Two

  • OS
    Windows 11 Pro 24H2
    Computer type
    PC/Desktop
    Manufacturer/Model
    Intel NUC12WSHi7
    CPU
    12th Gen Intel Core i7-1260P, 2100 MHz
    Motherboard
    NUC12WSBi7
    Memory
    64 GB
    Graphics Card(s)
    Intel Iris Xe
    Sound Card
    built-in Realtek HD audio
    Monitor(s) Displays
    Dell U3219Q
    Screen Resolution
    3840x2160 @ 60Hz
    Hard Drives
    Samsung SSD 990 PRO 1TB
    Keyboard
    CODE 104-Key Mechanical with Cherry MX Clears
    Antivirus
    Microsoft Defender
  • Operating System
    Linux Mint 21.2 (Cinnamon)
    Computer type
    PC/Desktop
    Manufacturer/Model
    Intel NUC8i5BEH
    CPU
    Intel Core i5-8259U CPU @ 2.30GHz
    Memory
    32 GB
    Graphics card(s)
    Iris Plus 655
    Keyboard
    CODE 104-Key Mechanical with Cherry MX Clears
The forfiles command is your friend here.

FORFILES /P C:\WINDOWS /S /M *.txt /D +2024-6-12

Would give me all of the files in C:\Windows and subdirectories (/S), matching the pattern *.txt, created on or after June 12, 2024.
Thanks for your quick reply ! I knew the command line would have useful commands like this. My problem is that I don't know the physical path name. In Explorer, my camera folder is
Code:
This PC\Chris A51\SD card\DCIM\Camera
but the command line does not recognize this path:

Code:
C:\Windows>dir "This PC\Chris A51\SD card\DCIM\Camera"
The system cannot find the path specified.


C:\Windows>dir "\\This PC\Chris A51\SD card\DCIM\Camera"
The network path was not found.


C:\Windows>dir "\This PC\Chris A51\SD card\DCIM\Camera"
The system cannot find the path specified.

What am I missing ?
 

My Computer

System One

  • OS
    Windows 11 Pro Version 22H2 (OS Build 22621.3155)
    Computer type
    PC/Desktop
    Manufacturer/Model
    Intel NUC12WSHi7
    CPU
    Intel Core i7-1260P
    Motherboard
    Intel NUC12WSHi7
    Memory
    64Gb
    Graphics Card(s)
    Intel Iris Xe Graphics
    Sound Card
    Intel Smart Sound for USB
    Monitor(s) Displays
    LG 34WP500 UltraWide Monitor
    Screen Resolution
    2560x1080
    Hard Drives
    Adata Legend 710 2Tb SSD
    PNY CS9000 2Tb SSD
    Keyboard
    Logitech K540 Bluetooth
    Mouse
    Logitech M310 Bluetooth
    Internet Speed
    200Mbps
    Browser
    Chrome
    Antivirus
    Avast Free Antivirus
I don't have a device I can test with. Maybe you can right-click the folder and Open In Terminal? If it opens the terminal in the correct folder, you can skip the /P part altogether.
 

My Computers

System One System Two

  • OS
    Windows 11 Pro 24H2
    Computer type
    PC/Desktop
    Manufacturer/Model
    Intel NUC12WSHi7
    CPU
    12th Gen Intel Core i7-1260P, 2100 MHz
    Motherboard
    NUC12WSBi7
    Memory
    64 GB
    Graphics Card(s)
    Intel Iris Xe
    Sound Card
    built-in Realtek HD audio
    Monitor(s) Displays
    Dell U3219Q
    Screen Resolution
    3840x2160 @ 60Hz
    Hard Drives
    Samsung SSD 990 PRO 1TB
    Keyboard
    CODE 104-Key Mechanical with Cherry MX Clears
    Antivirus
    Microsoft Defender
  • Operating System
    Linux Mint 21.2 (Cinnamon)
    Computer type
    PC/Desktop
    Manufacturer/Model
    Intel NUC8i5BEH
    CPU
    Intel Core i5-8259U CPU @ 2.30GHz
    Memory
    32 GB
    Graphics card(s)
    Iris Plus 655
    Keyboard
    CODE 104-Key Mechanical with Cherry MX Clears
I don't have a device I can test with. Maybe you can right-click the folder and Open In Terminal? If it opens the terminal in the correct folder, you can skip the /P part altogether.
I did not know about "Open in Terminal". Glad to have learnt about it, thanks. But as sod's luck would have it, this option is not shown for folders on my camera, only for regular devices (USB sticks included). The context menu for the camera is much smaller than usual. Clearly, the camera's file system is handled much different from anything else.
 

My Computer

System One

  • OS
    Windows 11 Pro Version 22H2 (OS Build 22621.3155)
    Computer type
    PC/Desktop
    Manufacturer/Model
    Intel NUC12WSHi7
    CPU
    Intel Core i7-1260P
    Motherboard
    Intel NUC12WSHi7
    Memory
    64Gb
    Graphics Card(s)
    Intel Iris Xe Graphics
    Sound Card
    Intel Smart Sound for USB
    Monitor(s) Displays
    LG 34WP500 UltraWide Monitor
    Screen Resolution
    2560x1080
    Hard Drives
    Adata Legend 710 2Tb SSD
    PNY CS9000 2Tb SSD
    Keyboard
    Logitech K540 Bluetooth
    Mouse
    Logitech M310 Bluetooth
    Internet Speed
    200Mbps
    Browser
    Chrome
    Antivirus
    Avast Free Antivirus
For This PC use c:\Users
Is Chris A51 your user name?
 

My Computer

System One

  • OS
    Windows 11 Pro
    Computer type
    PC/Desktop
    Manufacturer/Model
    Custom Built
    CPU
    INTEL i9-10920X LGA 2066
    Motherboard
    Gigabyte X299-UD4 Pro F9
    Memory
    64 GB (4 X 16 GB) G-Skill V Series DDR4 3200 Quad Channel
    Graphics Card(s)
    EVGA GTX 1060 SC 3 GB
    Sound Card
    Realtek Onboard ALC1220
    Monitor(s) Displays
    2 x Samsung S27E310
    Screen Resolution
    1920x1080
    Hard Drives
    2 x Samsung 970 EVO Plus NVMe M2 500B
    2 x 6TB WD6003FZBX SATA
    PSU
    Seasonic X-1050
    Case
    Thermaltake Armor+
    Cooling
    Corsair H80i V2 Liquid AOI Cooler
    Keyboard
    Logitech G510s
    Mouse
    Logitech MX Master2S
    Internet Speed
    500Mbs
    Browser
    Edge (Canary, Dev, Beta,Stable), Chrome
    Antivirus
    ESET NOD32 17.0.16.0
    Other Info
    Netgear Orbi Mesh router,
    LG WH12LS39K Blu-Ray/DVD,
    Malwarebytes Pro 4.6.8
    Cyber Power CP1500PFCLCD UPS
I would bet it’s an A51 phone belonging to a person named Chris.
 

My Computers

System One System Two

  • OS
    Windows 11 Pro 24H2
    Computer type
    PC/Desktop
    Manufacturer/Model
    Intel NUC12WSHi7
    CPU
    12th Gen Intel Core i7-1260P, 2100 MHz
    Motherboard
    NUC12WSBi7
    Memory
    64 GB
    Graphics Card(s)
    Intel Iris Xe
    Sound Card
    built-in Realtek HD audio
    Monitor(s) Displays
    Dell U3219Q
    Screen Resolution
    3840x2160 @ 60Hz
    Hard Drives
    Samsung SSD 990 PRO 1TB
    Keyboard
    CODE 104-Key Mechanical with Cherry MX Clears
    Antivirus
    Microsoft Defender
  • Operating System
    Linux Mint 21.2 (Cinnamon)
    Computer type
    PC/Desktop
    Manufacturer/Model
    Intel NUC8i5BEH
    CPU
    Intel Core i5-8259U CPU @ 2.30GHz
    Memory
    32 GB
    Graphics card(s)
    Iris Plus 655
    Keyboard
    CODE 104-Key Mechanical with Cherry MX Clears
I would bet it’s an A51 phone belonging to a person named Chris.

It’s a bet I wouldn’t take against you. Put a thousand on for me also.
 

My Computers

System One System Two

  • OS
    Windows 11 Pro 23H2 Build 22631.5039
    Computer type
    PC/Desktop
    Manufacturer/Model
    Sin-built
    CPU
    Intel(R) Core(TM) i7-4770K CPU @ 3.50GHz (4th Gen?)
    Motherboard
    ASUS ROG Maximus VI Formula
    Memory
    32.0 GB of I forget and the box is in storage.
    Graphics Card(s)
    Gigabyte nVidia GeForce GTX 1660 Super OC 6GB
    Sound Card
    Onboard
    Monitor(s) Displays
    5 x LG 25MS500-B - 1 x 24MK430H-B - 1 x Wacom Pro 22" Tablet
    Screen Resolution
    All over the place
    Hard Drives
    Too many to list.
    OS on Samsung 1TB 870 QVO SATA
    PSU
    Silverstone 1500
    Case
    NZXT Phantom 820 Full-Tower Case
    Cooling
    Noctua NH-D15 Elite Class Dual Tower CPU Cooler / 6 x EziDIY 120mm / 2 x Corsair 140mm somethings / 1 x 140mm Thermaltake something / 2 x 200mm Corsair.
    Keyboard
    Corsair K95 / Logitech diNovo Edge Wireless
    Mouse
    Logitech: G402 / G502 / Mx Masters / MX Air Cordless
    Internet Speed
    1000/400Mbps
    Browser
    All sorts
    Antivirus
    Kaspersky Premium
    Other Info
    I’m on a horse.
  • Operating System
    Windows 11 Pro 23H2 Build: 22631.4249
    Computer type
    Laptop
    Manufacturer/Model
    LENOVO Yoga 7i EVO OLED 14" Touchscreen i5 12 Core 16GB/512GB
    CPU
    Intel Core 12th Gen i5-1240P Processor (1.7 - 4.4GHz)
    Memory
    16GB LPDDR5 RAM
    Graphics card(s)
    Intel Iris Xe Graphics Processor
    Sound Card
    Optimized with Dolby Atmos®
    Screen Resolution
    QHD 2880 x 1800 OLED
    Hard Drives
    M.2 512GB
    Antivirus
    Defender / Malwarebytes
    Other Info
    …still on a horse.
my camera folder is
Code:
This PC\Chris A51\SD card\DCIM\Camera
but the command line does not recognize this path:
Code:
C:\Windows>dir "This PC\Chris A51\SD card\DCIM\Camera"
The system cannot find the path specified.

C:\Windows>dir "\\This PC\Chris A51\SD card\DCIM\Camera"
The network path was not found.

C:\Windows>dir "\This PC\Chris A51\SD card\DCIM\Camera"
The system cannot find the path specified.

If Chris A51 is the device name of a camera, then dir "\\Chris A51\SD card\DCIM\Camera" (without the 'This PC' bit) should work.

If Chris A51 is your user folder then you can use "%userprofile%\SD card\DCIM\Camera" in the command line.
The userprofile environment variable contains the path to your user folder.
 
Last edited:

My Computers

System One System Two

  • OS
    Windows 11 Home
    Computer type
    Laptop
    Manufacturer/Model
    Acer Aspire 3 A315-23
    CPU
    AMD Athlon Silver 3050U
    Memory
    8GB
    Graphics Card(s)
    Radeon Graphics
    Monitor(s) Displays
    laptop screen
    Screen Resolution
    1366x768 native resolution, up to 2560x1440 with Radeon Virtual Super Resolution
    Hard Drives
    1TB Samsung EVO 870 SSD
    Internet Speed
    50 Mbps
    Browser
    Edge, Firefox
    Antivirus
    Defender
    Other Info
    fully 'Windows 11 ready' laptop. Windows 10 C: partition migrated from my old unsupported 'main machine' then upgraded to 11. A test migration ran Insider builds for 2 months. When 11 was released on 5th October 2021 it was re-imaged back to 10 and was offered the upgrade in Windows Update on 20th October. Windows Update offered the 22H2 Feature Update on 20th September 2022. It got the 23H2 Feature Update on 4th November 2023 through Windows Update, and 24H2 on 3rd October 2024 through Windows Update by setting the Target Release Version for 24H2.

    My SYSTEM THREE is a Dell Latitude 5410, i7-10610U, 32GB RAM, 512GB NVMe ssd, supported device running Windows 11 Pro.

    My SYSTEM FOUR is a 2-in-1 convertible Lenovo Yoga 11e 20DA, Celeron N2930, 8GB RAM, 256GB ssd. Unsupported device: currently running Win10 Pro, plus Win11 Pro RTM and Insider Dev, Beta, and RP 24H2 as native boot vhdx.

    My SYSTEM FIVE is a Dell Latitude 3190 2-in-1, Pentium Silver N5030, 8GB RAM, 512GB NVMe ssd, supported device running Windows 11 Pro, plus Insider Beta, Dev, and Canary builds (and a few others) as a native boot .vhdx.

    My SYSTEM SIX is a Dell Latitude 5550, Core Ultra 7 165H, 64GB RAM, 1TB NVMe SSD, supported device, Windows 11 Pro 24H2, Hyper-V host machine.
  • Operating System
    Windows 11 Pro
    Computer type
    Laptop
    Manufacturer/Model
    Dell Latitude E4310
    CPU
    Intel® Core™ i5-520M
    Motherboard
    0T6M8G
    Memory
    8GB
    Graphics card(s)
    (integrated graphics) Intel HD Graphics
    Screen Resolution
    1366x768
    Hard Drives
    500GB Crucial MX500 SSD
    Browser
    Firefox, Edge
    Antivirus
    Defender
    Other Info
    unsupported machine: Legacy bios, MBR, TPM 1.2, upgraded from W10 to W11 using W10/W11 hybrid install media workaround. In-place upgrade to 22H2 using ISO and a workaround. Feature Update to 23H2 by manually installing the Enablement Package. In-place upgrade to 24H2 using hybrid 23H2/24H2 install media. Also running Insider Beta, Dev, and Canary builds as a native boot .vhdx.

    My SYSTEM THREE is a Dell Latitude 5410, i7-10610U, 32GB RAM, 512GB NVMe ssd, supported device running Windows 11 Pro.

    My SYSTEM FOUR is a 2-in-1 convertible Lenovo Yoga 11e 20DA, Celeron N2930, 8GB RAM, 256GB ssd. Unsupported device: currently running Win10 Pro, plus Win11 Pro RTM and Insider Dev, Beta, and RP 24H2 as native boot vhdx.

    My SYSTEM FIVE is a Dell Latitude 3190 2-in-1, Pentium Silver N5030, 8GB RAM, 512GB NVMe ssd, supported device running Windows 11 Pro, plus Insider Beta, Dev, and Canary builds (and a few others) as a native boot .vhdx.

    My SYSTEM SIX is a Dell Latitude 5550, Core Ultra 7 165H, 64GB RAM, 1TB NVMe SSD, supported device, Windows 11 Pro 24H2, Hyper-V host machine.
If Chris A51 is the device name of a camera, then dir "\\Chris A51\SD card\DCIM\Camera" (without the 'This PC' bit) should work.
Thanks for your reply. Indeed Chris A51 is the phone's device name.

2024-07-14_075038.jpg

Alas, that command does not work either. I believe I had already tried that too.

2024-07-14_075142.jpg
 
Last edited:

My Computer

System One

  • OS
    Windows 11 Pro Version 22H2 (OS Build 22621.3155)
    Computer type
    PC/Desktop
    Manufacturer/Model
    Intel NUC12WSHi7
    CPU
    Intel Core i7-1260P
    Motherboard
    Intel NUC12WSHi7
    Memory
    64Gb
    Graphics Card(s)
    Intel Iris Xe Graphics
    Sound Card
    Intel Smart Sound for USB
    Monitor(s) Displays
    LG 34WP500 UltraWide Monitor
    Screen Resolution
    2560x1080
    Hard Drives
    Adata Legend 710 2Tb SSD
    PNY CS9000 2Tb SSD
    Keyboard
    Logitech K540 Bluetooth
    Mouse
    Logitech M310 Bluetooth
    Internet Speed
    200Mbps
    Browser
    Chrome
    Antivirus
    Avast Free Antivirus
Windows explorer is an object manager not simply a file manager. So it can represent objects from a device connected by media transfer protocol (mtp) as well as files. But mtp objects aren't files and you're trying to treat them as files - which is why it's not working.
It's possible to use the "shell objects for scripting" to work with these objects. If you try a Web search for "windows command line mtp" you should find some ideas as to how you might deal with these objects.
However, on your phone they are files, so with a file manager on your phone you should be able to sort and move files to different sub folders. You should also be able to change the default folder where photos are saved. If you did this monthly that might make managing the photos easier.
When you get the photos on your pc it will be easier to work with folders that don't contain thousands of images.

Mike
 

My Computer

System One

  • OS
    Windows 11 23H2 Pro
    Computer type
    PC/Desktop
    Manufacturer/Model
    MSI
    CPU
    i3-1215U
    Memory
    8GB
    Monitor(s) Displays
    Dell S2721
    Screen Resolution
    3840x2160
    PSU
    External 65W
    Keyboard
    Cherry mechanical (Blue)
    Mouse
    Microsoft
    Browser
    FireFox
    Antivirus
    MS
Thanks for that Mike. I guess you are right, Explorer does a decent job presenting the phone as a real filesystem, whereas it isn't. I'll check out these shell objects, but I think my best bet is, as you say, to organize the humongous wad of pics and videos on my phone. Damn grandkids 😁
 

My Computer

System One

  • OS
    Windows 11 Pro Version 22H2 (OS Build 22621.3155)
    Computer type
    PC/Desktop
    Manufacturer/Model
    Intel NUC12WSHi7
    CPU
    Intel Core i7-1260P
    Motherboard
    Intel NUC12WSHi7
    Memory
    64Gb
    Graphics Card(s)
    Intel Iris Xe Graphics
    Sound Card
    Intel Smart Sound for USB
    Monitor(s) Displays
    LG 34WP500 UltraWide Monitor
    Screen Resolution
    2560x1080
    Hard Drives
    Adata Legend 710 2Tb SSD
    PNY CS9000 2Tb SSD
    Keyboard
    Logitech K540 Bluetooth
    Mouse
    Logitech M310 Bluetooth
    Internet Speed
    200Mbps
    Browser
    Chrome
    Antivirus
    Avast Free Antivirus

Latest Support Threads

Back
Top Bottom