Windows 10: is there a way to delete every x number of files via CMD or powershell

Discus and support is there a way to delete every x number of files via CMD or powershell in Windows 10 Support to solve the problem; in a folder I have 300 files (in my case its over 25k). I wish to delete every 20, or every 30 files, or every set pattern of files, how can this be... Discussion in 'Windows 10 Support' started by m18xr2, Nov 15, 2020.

  1. m18xr2 Win User

    is there a way to delete every x number of files via CMD or powershell


    in a folder I have 300 files (in my case its over 25k).

    I wish to delete every 20, or every 30 files, or every set pattern of files, how can this be done?

    things i've tried, using a few selection tool to select every set number of files so I can delete but none has worked on simple ones such as every 20 or every 30 files.

    please help!

    :)
     
    m18xr2, Nov 15, 2020
    #1
  2. M3cael Win User

    Only write one number to log file and delete old ones?

    Hey,

    I'm trying to have some software read from a .text file a number (GPU Temp) but the software will only the first number in a list (Or the first anything)

    Is there a way to have to log file delete the previous entries and write the new number in it's place without any headers?


    EDIT:

    Sorry I'll try again.

    I have some webcam software that can read a number (or whatever) from a text file and then it displays the number as an overlay.

    See here: http://10.244.193.13:8081/

    I was trying to use GPU-z to do this but as it logs as a list the webcam software can't update properly (also it reads the headings of the file and displays them instead)

    Is there anyway to alter the logging to only output just the number (GPU Temp) and to delete the old numbers so the new value is the only value in the file.
     
    M3cael, Nov 15, 2020
    #2
  3. Instructions for deleting files, using CMD

    Hello to the Community,

    Need to delete lots of files; some are large.

    I'm looking for the steps to permanently delete selected files, using CMD (I am NOT a skilled User)

    The standard Delete via File Explorer sometimes doens't work....and/or is very slow to delete.

    Its 2-step operation... to collect, and then delete via the Recycle Bin .... takes
    approximately forever on some files.

    Google research shows me there's some simple ways to use CMD like DEL / RMDIR / /Q /S But I don't know how to use them.

    Could someone send me the specific steps I should enter?

    And also, what is the exact layout/format for defining the file(s) to be deleted, in each CMD string ?

    Thank you,

    Gary
     
    Gary_S_1943, Nov 15, 2020
    #3
  4. M3cael Win User

    is there a way to delete every x number of files via CMD or powershell

    Only write one number to log file and delete old ones?

    Sorry I'll try again.

    I have some webcam software that can read a number (or whatever) from a text file and then it displays the number as an overlay.

    See here: http://10.244.193.13:8081/

    I was trying to use GPU-z to do this but as it logs as a list the webcam software can't update properly (also it reads the headings of the file and displays them instead)

    Is there anyway to alter the logging to only output just the number (GPU Temp) and to delete the old numbers so the new value is the only value in the file.
     
    M3cael, Nov 15, 2020
    #4
Thema:

is there a way to delete every x number of files via CMD or powershell

Loading...
  1. is there a way to delete every x number of files via CMD or powershell - Similar Threads - delete every number

  2. Can't create or delete files and folder in CMD or PowerShell

    in Windows 10 Gaming
    Can't create or delete files and folder in CMD or PowerShell: I am running Windows 11 Pro 64-bit 24H2 with the latest updates.For the past few weeks, I have been unable to create or delete files and directories in `CMD` or `PowerShell`.Example:C:\Users\MyUser>echo "some text" > new-file.txt The system cannot find the file specified....
  3. Can't create or delete files and folder in CMD or PowerShell

    in Windows 10 Software and Apps
    Can't create or delete files and folder in CMD or PowerShell: I am running Windows 11 Pro 64-bit 24H2 with the latest updates.For the past few weeks, I have been unable to create or delete files and directories in `CMD` or `PowerShell`.Example:C:\Users\MyUser>echo "some text" > new-file.txt The system cannot find the file specified....
  4. VBoxManage: Control VirtualBox via CMD or PowerShell

    in Windows 10 Ask Insider
    VBoxManage: Control VirtualBox via CMD or PowerShell: [ATTACH] submitted by /u/sn0oz3 [link] [comments] https://www.reddit.com/r/Windows10/comments/12znloy/vboxmanage_control_virtualbox_via_cmd_or/
  5. How to delete .lnk files using CMD or Powershell?

    in Windows 10 Gaming
    How to delete .lnk files using CMD or Powershell?: I want to delete two shortcuts in my desktop using powershell or cmd but each of them doesn't recognize them. when I enter `dir` in both cmd and pwsh, they jusy not show the shortcuts. it seems like they are ghosts. how can I make to fix this?...
  6. How to delete .lnk files using CMD or Powershell?

    in Windows 10 Software and Apps
    How to delete .lnk files using CMD or Powershell?: I want to delete two shortcuts in my desktop using powershell or cmd but each of them doesn't recognize them. when I enter `dir` in both cmd and pwsh, they jusy not show the shortcuts. it seems like they are ghosts. how can I make to fix this?...
  7. How to delete user account with its folder via CMD or Powershell

    in Windows 10 Network and Sharing
    How to delete user account with its folder via CMD or Powershell: I have windows 10 machines with several users on it. I want to delete these user via CMD or Powershell with all their folders desktop, download, ........etc The below command : net user Test /delete only delete the user which is not enough....
  8. Open Cmd via PowerShell, command?

    in Windows 10 BSOD Crashes and Debugging
    Open Cmd via PowerShell, command?: Please i need to open cmd win + r and so i know i need to know how to open it via powershell pls (.bat and so i know it needs to be opened via powershell. Pls PowerShell command to open cmd? Cmd über PowerShell öffnen, Befehl?
  9. Is there a way to change wallpaper via cmd/batch file?

    in Windows 10 Ask Insider
    Is there a way to change wallpaper via cmd/batch file?: We're doing a ton of Windows 7 upgrades to Windows 10 (clean installs, not in-place upgrades) and we have a batch file that runs a bunch of stuff as part of the new PC deployment process. Someone else wrote the batch a while back and I'm just trying to improve it a bit. I'd...
  10. Is there a way to remove a device via cmd?

    in Windows 10 Drivers and Hardware
    Is there a way to remove a device via cmd?: Hi all I want to remove a device from "Devices". (See attachment) I tried using devcon.exe remove using device ID. The output says: it removed 1 device and the Bluetooth device is removed from >"Devices". But as soon as i refresh Device Manager the Bluetooth device comes...